How maintain state for checkboxes in the gridview control while page changing

Posted by Gsrinivas under ASP.NET on 9/14/2009 | Views : 6203 | Status : [Member] | Replies : 6
Hi
i have a gridview control with 2 pages and i have a template feild checkbox
so i checked two checkboxes in page1 and go to the second page when come back to the first page i lost the check boxes state.
so please give me the solution

Thanks & Regards
Srinivas Reddy




Responses

Posted by: Kasarlaravi on: 9/20/2011 [Member] Starter | Points: 25

Up
0
Down
Hi ,
Please check this url http://www.dotnetfunda.com/articles/article1600-maintaining-state-of-checkboxes-in-a-pagination-enabled-gridview-.aspx


Ravi Kasarla

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

Posted by: Blessyjees on: 9/20/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Please keep your checkbox values in a hash table like key value when going to other pages. Are you using pagination in the grid view, if so check each checkbox value in the hastable and bind this value in datagridview's databound event.

Blessy

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

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

Posted by: Vuyiswamb on: 9/14/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day Gsrinivas

Try to Put inside an Update Panel and try it again. If it does not work tell me.

Thank you for Posting at dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Gsrinivas on: 9/14/2009 [Member] Starter

Up
0
Down
hi,
i have placed the gridview control in the update panel even though the checkboxes losts their state in the post backs

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

Posted by: Vuyiswamb on: 9/14/2009 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day

This is exactly what you want. Maintaining the state of checked in paged Gridview

http://aspalliance.com/articleViewer.aspx?aId=774&pId=-1

Thank you for posting at dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

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

Posted by: Rtpharry on: 9/15/2009 [Member] [MVP] Bronze

Up
0
Down
How are you going to the second page? By clicking a submit button, or a link, etc?

Are you updating the database before you move on to the second page?

If you come back to the first page again then you could be rebinding the existing data (which is unchecked).

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

Login to post response