标头复选框不选中所有子项,不选中所有子项 [英] Header checkbox on checking not makin all the child child check boxes checked
本文介绍了标头复选框不选中所有子项,不选中所有子项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了一个非常不寻常的问题.我编写了一个Java脚本,该脚本可以更早地正常工作,如果在网格视图中选择了标题复选框,则所有复选框都已选中,但是比向页面添加其他功能和控件时它停止了工作.我无法猜测为什么会这样.我的JavaScript代码是:-
Hi,
I am suffering from a very unusual problem. I wrote a java script which was working fine earlier making all the check boxes checked if I select the header checkbox in grid view but than when I added other functionality and controls to my page it stopped working. I am unable to guess why is it happening. My code of javascript is :-
function SelectAll(id) {
var frm = document.forms[0];
for (i=0;i<frm.elements.length;i++) {
if (frm.elements[i].type == "checkbox") {
frm.elements[i].checked = document.getElementById(id).checked;
}
}
}
和C#代码相同的是:
and c# code for the same is:
if (e.Row.RowType == DataControlRowType.Header)
{
((CheckBox)e.Row.FindControl("chkAll")).Attributes.Add("onclick", "javascript:SelectAll('" + ((CheckBox)e.Row.FindControl("chkAll")).ClientID + "')");
}
请帮助guyz!
Please help guyz !
推荐答案
您可以找到一些最好的文章来完成此任务.请点击以下链接:
选择/取消选择GridView内部的所有复选框 [ ^ ]
使用Javascript在GridView中选中/取消选中CheckBox [ ^ ]
祝一切顺利.
--Amit
Hi,
You can find some of the best article to do this task. Follow the links:
Selecting / Deselecting all the CheckBoxes Inside a GridView[^]
Check/uncheck CheckBox in a GridView using Javascript[^]
All the best.
--Amit
检查此
此处 [
Hi ,
Check this
Here[^]
Best Regards
M.Mitwalli
这篇关于标头复选框不选中所有子项,不选中所有子项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文