当前位置:编程学习 > C#/ASP.NET >>

gridview 删除全选

--------------------编程问答-------------------- foreach (GridViewRow row in GridView1.Rows)  
  {  
  cbx =(CheckBox)row.Cells[8].FindControl("cbxId");  
  if (cbx.Checked)  
  {  
  ids += ((HiddenField)(row.FindControl("HiddenField1"))).Value + ",";  
  }  
  }  
  if(ids.EndWiths(",")  
  ids = ids.Substring(0, ids.Length - 1);  
   
if(!IsPostBack)绑定数据  
或  
foreach (GridViewRow gr in this.Gridview1.Rows)  
  {  
  if (((CheckBox)gr.FindControl("CheckBox1")).Checked)  
  {}  
  }  
 
 
--------------------编程问答--------------------
引用 1 楼 wuyq11 的回复:
foreach (GridViewRow row in GridView1.Rows)  
  {  
  cbx =(CheckBox)row.Cells[8].FindControl("cbxId");  
  if (cbx.Checked)  
  {  
  ids += ((HiddenField)(row.FindControl("HiddenField1"))).Val……
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,