在itemtemplate里,checkbox 的checked设为true就可以了
<asp:CheckBox id="CheckBox1"
AutoPostBack="True|False"
Text="Label"
Checked="True"
OnCheckedChanged="OnCheckedChangedMethod"
runat="server"/>
<asp:CheckBox id="CheckBox1"
AutoPostBack="True|False"
Text="Label"
Checked="True"
OnCheckedChanged="OnCheckedChangedMethod"
runat="server"/>
用DataGrid1.Items[i].FindControl("chk")根本就找不到checked属性
chk.checked = true;
不知道行不行,你试试
CheckBox chk = (CheckBox)DataGrid1.Items[0].Cells[0].FindControl("chk");
chk.Checked = true;
我试了,没问题
ch = Me.DataGrid1.Items(i).Cells(0).FindControl("CheckBox1")
ch.Checked = True
Next