DataGrid里的每一行都有一个checkbox,请问怎么触发checkbox的选中和不选中事件?? DataGrid里的每一行都有一个checkbox,请问怎么触发checkbox的选中和不选中事件?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 每条记录上有一个数字,每选中一个checkbox 都要让这个数字加起来,显示在页面上 ds.Tables["Point"].ColumnChanging += new System.Data.DataColumnChangeEventHandler(this.Point_ColumnChanging); 我的需求是:在web上有个datagrid,我想在第一列显示一个checkbox。然后单击个box,如果没有打钩的就打上钩,打钩的,就去掉钩。另外,单击删除按钮,将当前页的打钩的删除掉。如何获取datagrid中打钩的行? 用checkedchanged事件吧,该事件在更改控件的选中状态时触发. 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 我想看看C#.net2005中编写的。有没有直接在*.cs中写的代码?关于我的需求。 http://community.csdn.net/Expert/topic/5497/5497453.xml?temp=.2442743 C#如何获取XML文档之下的所有节点 在程序中,正则中的引号如何处理? 这段代码要跑19个小时!!!谁知道怎么优化一下 TreeView的问题,请高手来下 为何用这种委托方式刷新窗口无效?在线等..... 如何把类似这样的条件语句,拆成 后 方到 DataGrid 里,供客户可自行配制? 100分 !一个简单的数据库问题(在线等!) 求将语音(最好是英文)装换为文字的源代码 关于用户自定义控件的传值问题! help me!! 大家从数据通过查询获取的数据都放在那里了? 新手问一简单的文本显示问题,谢谢各位给与指点!
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
关于我的需求。