how to retain the checkboxvalue checked in gridview with paging

Posted by Prince5 under ASP.NET on 2/23/2009 | Views : 8464 | Status : [Member] | Replies : 2
hi
i have gridview with paging enabled, and have checkbox in trmplate field.
dere are 20 records. i am displaying 5 records at once. i have checkbox i am checking record 3 and 4, and going to next page checking record 9, so. on
and when i click button. it is able to retain only the selected value in the checkbox a. but for the last. all other values are lost.

how to retain the values checke in the checkbox in paging

foreach (GridViewRow row in GridView1.Rows)
{
CheckBox checkbox = (CheckBox)row.FindControl("CheckBox1");
if (checkbox.Checked)
{

int employeeID = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
}
}

this is my code
plz do provide solution how to retain it checked value in the checkbox




Responses

Posted by: Raja on: 2/23/2009 [Member] Starter

Up
0
Down
Please see following article

http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=51613


http://forums.asp.net/t/1292226.aspx

Thanks.


Regards,
Raja, USA

Prince5, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 2/23/2009 [Member] Bronze

Up
0
Down
You can follow the given link which will describe you how you can Maintain the state of the Checkbox in the Grid view

http://programming.top54u.com/post/Maintaining-Checkbox-state-while-GridView-Paging-in-C-sharp-ASP-Net.aspx

http://programming.top54u.com/post/Re-Populate-Checkboxes-while-GridView-Paging-in-C-sharp-ASP-Net.aspx

Prince5, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response