选择在asp.net的GridView多个复选框不工作 [英] select multiple checkbox in gridview in asp.net not working

查看:118
本文介绍了选择在asp.net的GridView多个复选框不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这code在 asp.net选择在 GridView控件多个复选框,但它是不工作

 保护无效cbheader_CheckedChanged(对象发件人,EventArgs的发送)
{    的foreach(GridViewRow gridViewRow在GridView1.Rows)
    {
        ((复选框)gridViewRow.FindControl(chkcol))
               .Checked =((复选框)发送方).Checked;
    }}


解决方案

尝试JavaScript来检查所有复选框在DataGrid中。回发请求是不是解决这个问题的好办法。还有就是如何实现使用JavaScript这样的功能一个很好的例子:
<一href=\"http://www.aspsnippets.com/Articles/Implement-check-all-checkbox-functionality-in-ASPNet-GridView-control-using-JavaScript.aspx\"相对=nofollow>实施检查使用JavaScript 在ASP.Net GridView控件的所有复选框功能

I am using this code to select multiple checkbox in GridView in asp.net but it is not working

protected void cbheader_CheckedChanged(object sender, EventArgs e)
{

    foreach (GridViewRow gridViewRow in GridView1.Rows)
    {
        ((CheckBox)gridViewRow.FindControl("chkcol"))
               .Checked = ((CheckBox)sender).Checked;
    }

}

解决方案

Try JavaScript to check all checkboxes in DataGrid. Postback requests is not a good idea to solve this. There is a good example of how to implement such functionality using JavaScript: Implement check all checkbox functionality in ASP.Net GridView control using JavaScript

这篇关于选择在asp.net的GridView多个复选框不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆