62,046
社区成员
发帖
与我相关
我的任务
分享
function SelectAll(tempControl)
{
//将除头模板中的其它所有的CheckBox取反
var theBox=tempControl;
xState=theBox.checked;
elem=theBox.form.elements;
for(i=0;i<elem.length;i++)
if(elem[i].type=="checkbox" && elem[i].id!=theBox.id)
{
// if(elem[i].checked!=xState)
elem[i].click();
}
}
function checkAll(chkAll)
{
//debugger;
var gvSend = document.getElementById("gdvResult");
if(gvSend!=null)
{
if(gvSend.rows.length>0)
{
if(chkAll.checked)
{
for(var i=1;i <gvSend.rows.length;i++)
{
var checkBox = gvSend.rows[i].cells[0].firstChild;
checkBox.checked=true;
}
}
else
{
for(var i=1;i <gvSend.rows.length;i++)
{
var checkBox = gvSend.rows[i].cells[0].firstChild;
checkBox.checked=false;
}
}
}
}
}
/// <summary>
/// 全选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void checkAll(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
if (cb.Text == "全选")
{
foreach (GridViewRow gvr in GridView1.Rows)
{
CheckBox cb1 = (CheckBox)gvr.FindControl("check");
cb1.Checked = cb.Checked;
}
}
}
protected void checkAll(object sender, EventArgs e)
{
CheckBox cb = (CheckBox)sender;
if (cb.Text == "全选")
{
foreach (GridViewRow gvr in GridView1.Rows)
{
CheckBox cb1 = (CheckBox)gvr.FindControl("check");
cb1.Checked = cb.Checked;
}
}
}
$(document).ready(function() {
$("#checkboxall").click(function() {
if ($(this).attr("checked")) {
$(":checkbox").each(function() {
$(this).attr("checked", true);
});
}
else {
$(":checkbox").each(function() {
$(this).attr("checked", false);
});
}
});
});