码迷,mamicode.com
首页 > Web开发 > 详细

ASP.net:GridView控件中实现全选和全反选

时间:2020-01-11 22:35:13      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:ebs   void   nta   website   find   object   als   protect   send   

E:\ASP.net\temp\WebSite1

CheckBox2控件的 AutoPostBack属性设置为true.

 

protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
{
   for(int i=0;i<=GridView1.Rows.Count-1;i++)
    {
       CheckBox chk = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
           if (CheckBox2.Checked == true)
            {
              chk.Checked = true;
            }
         else
          {
              chk.Checked = false;
          }
    }
}

ASP.net:GridView控件中实现全选和全反选

标签:ebs   void   nta   website   find   object   als   protect   send   

原文地址:https://www.cnblogs.com/sunnywam/p/12181260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!