http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=FF130C7F-3650-4DA6-8943-8AA4AF3E3459

解决方案 »

  1.   

    是在模板列里吧,在CheckBox里加上CommandName="aa" id=CheckBox1
    然后在ItemCommand事件里:
    public void ItemCommand(Object sender, DataGridCommandEventArgs e)
    {
    if (e.CommandName == "aa")
    {
    CheckBox dd = (CheckBox) e.Item.FindControl("CheckBox1"); 
    if(dd.Checked)
    {.....} }
    }
      

  2.   

    如果是填加在了Page页面里,CheckBox cb = (CheckBox)Page.Controls.FindControl("CheckBox1")
      

  3.   

    foreach(DataGridItem x in DataGrid1.Item)
    {
        if((CheckBox)x.FindControl("checkbox1").Checked)
        {
            delete~~~~~~~~~~~~~~
        }
    }
      

  4.   

    你看看这个,完全的动态添加列!
    http://218.84.107.5/i.aspx
      

  5.   

    ItemCommand:CheckBox cb = (CheckBox) e.Item.FindControl("CheckBox1");
      

  6.   

    CheckBox cb;for(int i=0;i<DataGrid1.Items.Count;i++)
    {

    cb=(CheckBox)DataGrid1.Items[i].Cells[0].FindControl("CheckBoxDuty");//CheckBoxDuty是控件的ID  if(cb.Checked)
      {
      

  7.   

    void Deletebt(Object Sender, EventArgs e) {
    for( int i = 0; i < MyDataGrid.Items.Count; i++ ){
          CheckBox chk = ( CheckBox )MyDataGrid.Items[i].FindControl("chk1");
    if( chk.Checked )
    {  
             ......
        }
               BindRepeater();
    }
    http://218.84.107.5/p.aspx
      

  8.   

    sorry,刚没说清楚。
    我是在DataGrid的ItemDataBound事件中增加的。
    CheckBox chk=new CheckBox();
    e.Item.Cells[3].Controls.Add(chk);但在一个button的click事件中,找不到这个添加的控件。
      

  9.   

    Public Function GetCheckBoxValue(ByVal strChkID As String) As Boolean
    Dim chk As CheckBox
    chk = Me.DataGrid.FindControl(strChkID)
    Return chk.Checked
    End Function