在itemtemplate里,checkbox 的checked设为true就可以了
<asp:CheckBox id="CheckBox1" 
     AutoPostBack="True|False"
     Text="Label"
     Checked="True"
     OnCheckedChanged="OnCheckedChangedMethod"
     runat="server"/>

解决方案 »

  1.   

    而且当把checkbox放在datagrid里面后,好像就没有OnCheckedChanged事件了
    用DataGrid1.Items[i].FindControl("chk")根本就找不到checked属性
      

  2.   

    CheckBox chk = (CheckBox)DataGridItem.Cells[n].FindControl("CheckBox控件ID");
    chk.checked = true;
    不知道行不行,你试试
      

  3.   

    当然找不到,你得转换成CheckBox控件类型才行DataGrid1.Items[i].FindControl("chk")这句好像是返回一个Control类型
      

  4.   

    我转了,也不行,我用上面的方法,是对chk,而不是对我的datagrid里面的控件
      

  5.   

    your checkbox in DataGrid.Items[n].Cells[n]
      

  6.   

    你的控件应处在某行的某个单元格中,难道在其它地方?
    CheckBox chk = (CheckBox)DataGrid1.Items[0].Cells[0].FindControl("chk");
    chk.Checked = true;
    我试了,没问题
      

  7.   

    For i = 0 To Me.DataGrid1.Items.Count - 1
        ch = Me.DataGrid1.Items(i).Cells(0).FindControl("CheckBox1")
        ch.Checked = True
    Next