如何通过分页获取网格视图中所选复选框的值? [英] how to get value of selected checkboxes in grid view with paging?

查看:100
本文介绍了如何通过分页获取网格视图中所选复选框的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用带有复选框的网格视图。在gridview中有一个分页概念。现在我想要一个按钮点击从gridview的所有页面的复选框值。现在我只获得一页的复选框值。请帮助..



要求是从网格视图中添加组中的成员。如果有更多的成员,那么将启用分页,如果我从第一页选择2个成员,从第二页选择3个成员,并按保存按钮,因此应添加5个成员。现在只添加当前页面成员。







提前感谢

解决方案

< blockquote> private void getvalue()

{

string Chk_id = string.Empty;



StringCollection sc = new StringCollection();



for(int i = 0; i< GridView1.Rows.Count; i ++)

{

CheckBox cb =(CheckBox)GridView1.Rows [i] .FindControl(Check_select);

string txt = cb.Text;

if (cb!= null)

{



if(cb.Checked == true)

{



Chk_id = GridView1.Rows [i] .Cells [7] .Text;



sc.Add (Chk_id);

setConnectionString(); //你的数据库连接。



}



}

Bind();





}


hi to all,
I am using a grid view with check box. there is a paging concept in that gridview. now i want checkbox value from all page of gridview on a button click. right now i m getting only one page's check box value. please help..

The requirement is to add members in group from grid view. If there are more members so paging will be enable and if i select 2 member from 1st page and 3 member from 2nd page and press Save button so 5 member should be added. right now only current page members are added.



thanks in advance

解决方案

private void getvalue()
{
string Chk_id = string.Empty;

StringCollection sc = new StringCollection();

for (int i = 0; i < GridView1.Rows.Count; i++)
{
CheckBox cb = (CheckBox)GridView1.Rows[i].FindControl("Check_select");
string txt = cb.Text;
if (cb != null)
{

if (cb.Checked==true)
{

Chk_id = GridView1.Rows[i].Cells[7].Text;

sc.Add(Chk_id);
setConnectionString();// your DB connection.

}

}
Bind();


}


这篇关于如何通过分页获取网格视图中所选复选框的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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