DataGrid里的每一行都有一个checkbox,请问怎么触发checkbox的选中和不选中事件??

解决方案 »

  1.   

    每条记录上有一个数字,每选中一个checkbox 都要让这个数字加起来,显示在页面上
      

  2.   

    ds.Tables["Point"].ColumnChanging += new System.Data.DataColumnChangeEventHandler(this.Point_ColumnChanging);
      

  3.   

    我的需求是:在web上有个datagrid,我想在第一列显示一个checkbox。然后单击个box,如果没有打钩的就打上钩,打钩的,就去掉钩。另外,单击删除按钮,将当前页的打钩的删除掉。如何获取datagrid中打钩的行?
      

  4.   

    用checkedchanged事件吧,该事件在更改控件的选中状态时触发.
      

  5.   

    html页head里面声明<script language="javascript">
     function uncheckAllBox()
     {
       var e=document.getElementsByTagName("input");
       for(i=0;i<e.length;i++)
       {
         if(e[i].type=="checkbox")
         {
           if(e[i].checked)
             e[i].checked=false;
           else
              e[i].checked=true;
         }
       }
       return false;
     }
    </script>
    cs.页load事件
    if(!this.IspostBack)
    {
    this.btnuncheckall.Attributes.Add("onclick","return uncheckAllBox();");
    }
    在删除按纽里面写
    string strCondition="(";
    foreach(System.Web.UI.WebControls.DataGridItem item in Grid.Items)
    {   
    System.Web.UI.WebControls.CheckBox chkSelect=(System.Web.UI.WebControls.CheckBox)item.FindControl(chkSelectID);
    if(chkSelect.Checked)
    {
    if(strCondition.Equals("("))
    {
    strCondition+=Grid.DataKeys[item.ItemIndex].ToString();
    }
    else
    {
    strCondition+=","+Grid.DataKeys[item.ItemIndex].ToString();
    }
    }
    }
    if(strCondition.Equals("("))
    {
    return;
    }
    strCondition+=")";
    }
    delete **** in  strCondition
      

  6.   

    我想看看C#.net2005中编写的。有没有直接在*.cs中写的代码?
    关于我的需求。
      

  7.   

    http://community.csdn.net/Expert/topic/5497/5497453.xml?temp=.2442743