I have a grid view with number of pages.using check box i like to get value of selected check boxes. i have no idea to get value from selected check boxes in different pages.Please give me your suggestion and coding for this.
Asked
Active
Viewed 9,244 times
0
-
Better way is to put a hidden field on the top of the page(outside of gridview) and on click of checkboxes, you should put the related id or some value in comma separated format in hidden field. On submit of the form, you can split the hidden field value string with comma as delimiter and there you go. – Sain Pradeep Oct 17 '13 at 05:29
2 Answers
1
Use this one
protected void btnClick_Click(object sender, EventArgs e)
{
StringBuilder sbQuery = new StringBuilder();
bool flag = false;
foreach (GridViewRow row in gridview1.Rows)
{
if (((CheckBox)row.FindControl("chk")).Checked)
{
flag = true;
//------
}
}
}

Arun Singh
- 63
- 6
-
what is the use of this line in your code CheckBox chk = (CheckBox)row.FindControl("chk"); – Sain Pradeep Oct 17 '13 at 05:06
-
hi, whether this allows us to select value from multiple pages.if it possible how to get those values and display it in a label – Gopi Oct 17 '13 at 05:07
1
As you have illustarted in question i am assuming that you want checkboxes values so i have one linke which i providing you this will help you to understand how would you achieve and also i am recommanding you to use javascript
Get the value of checked checkbox?
this is javascript i have other links of gridview also
http://forums.asp.net/t/1125079.aspx
How to get checkbox value from gridview when checkbox OnCheckedChanged
regards...:)