string
[] arrs
=
"
aa,bb,cc
"
.Split(
'
,
'
);
this .DataGrid1.DataSource = arrs;
this .DataGrid1.DataBind();
this .DataGrid1.DataSource = arrs;
this .DataGrid1.DataBind();
或者 ArrList al = ....;
this.DataGrid1.DataSource = al;
this.DataGrid1.DataBind();
大家会问BoundColumn的DataField写什么?ItemTemplate怎么写绑定语句?
答案如下:
<
asp:BoundColumn DataField
=
"
!
"
HeaderText
=
"
test
"
/>
< asp:TemplateColumn HeaderText = " test " >
< ItemTemplate >
<% #Container.DataItem %>
</ ItemTemplate >
</ asp:TemplateColumn >
< asp:TemplateColumn HeaderText = " test " >
< ItemTemplate >
<% #Container.DataItem %>
</ ItemTemplate >
</ asp:TemplateColumn >