DataGrid中checkbox用JS脚本如何控制是否被选中
DataGrid中checkbox用JS脚本如何控制是否被选中?谢谢提供代码!
------解决方案--------------------private void IsChecked()
{
string jsScript = " <script language=JavaScript> \n "
+ " <!-- \n "
+ "function IsChecked (frm) { \n "
+ " var chkNum=0;\n "
+ " // loop through all elements \n "
+ " for (i=0; i <frm.length; i++) {\n \n "
+ " // Look for our checkboxes only \n "
+ " if (frm.elements[i].name.indexOf ( 'chkChoose ') !=-1) { \n "
+ " // 选中的记录 \n "
+ " if(frm.elements[i].checked) { \n "
+ " chkNum = chkNum +1;\n "
+ " } \n "
+ " } \n "
+ " } \n "
+ " if(chkNum == 0){ \n "
+ " alert( '请选择资产扩展属性! ');\n "
+ " return false;}\n "
+ "} \n \n \n "
+ "//--> \n "
+ " </script> ";
if(!IsClientScriptBlockRegistered( "clientScript "))
{
// 测试该ID的脚本是否已经被注册,若还没被注册则将之注册
Page.RegisterClientScriptBlock( "clientScript ",jsScript);
}
// ---------修改记录结束----------
}
------解决方案--------------------http://post.10026.com/net/ASP/20051135202_4355305.shtml