GridView中CheckBox、CheckBoxField取值的方法
2012-11-30 21:09
363 查看
前台代码:
<Columns>
<asp:TemplateField HeaderText="选择">
<HeaderStyle HorizontalAlign="Center" Height="25px" Width="45px" />
<ItemTemplate>
<asp:CheckBox ID="ckb" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="sid" HeaderText="编号" />
<asp:BoundField DataField="cname" HeaderText="姓名" />
</Columns>
后台代码:
<Columns>
<asp:TemplateField HeaderText="选择">
<HeaderStyle HorizontalAlign="Center" Height="25px" Width="45px" />
<ItemTemplate>
<asp:CheckBox ID="ckb" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="sid" HeaderText="编号" />
<asp:BoundField DataField="cname" HeaderText="姓名" />
</Columns>
后台代码:
foreach (GridViewRow gvr in this.GridView1.Rows) { Control ctl = gvr.FindControl("ckb"); CheckBox ck = (CheckBox)ctl; if (ck.Checked) { TableCellCollection cell = gvr.Cells; string wid += cell[1].Text+","; } }
相关文章推荐
- GridView中CheckBox、CheckBoxField取值的方法集
- GridView中CheckBox、CheckBoxField取值的方法集
- GridView中CheckBox、CheckBoxField取值的方法集
- html中checkbox在GridView选中并取值方法(转载)
- CheckBoxField取值的方法
- GridView中CheckBox、CheckBoxField取值的方法集(转)
- JQuery中 input areatext select checkbox radio 取值方法
- GridView中出现“TemplateField 上不支持回调,因为某些控件不能在回调中正确更新。”的解决方法
- checkbox嵌套在repeater,gridview中的全选/反选(方法总结)
- ASP.NET Gridview 中使用checkbox删除的2种方法实例分享
- GridView中超链接HyperLinkField标签的使用方法
- Gridview的item含有checkbox,setOnItemClickListener方法失效的问题
- gridview使用TemplateField中的LinkButton时如何在RowCommand事件中找到当前行index的方法
- css中改变gridview中HyperLinkField字体颜色的方法
- Gridview的item含有checkbox,setOnItemClickListener方法失效的问题
- css中改变gridview中HyperLinkField字体颜色的方法
- ASP.NET Gridview 中使用checkbox删除的方法(两种)
- Gridview的item含有checkbox,setOnItemClickListener方法失效的问题
- Gridview 表头加入checkbox的方法
- 取得AspxGridview中某控件的值(适用RadioButton ,CheckBox)以及在AspGridView取得某一行的方法