且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.Net中的Label中显示GridView的Checked(Selected)CheckBox行(数据)

更新时间:2021-07-14 17:55:41

将您的功能更改为

Change Your function to
protected void Select_OnCheckedChanged(object sender, EventArgs e)
       {
           string name = string.Empty;
           foreach (GridViewRow row in this.gvCompanyListing.Rows)
           {
               CheckBox chkSelect = row.FindControl("cbSelect") as CheckBox;
               if (chkSelect.Checked)
               {
                   name += row.Cells[1].Text + ",";                  
               }
           }
 String[] tokens = name.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                   this.lblmsg.Text = string.Join("<br />", tokens);
 
       }