469,317 Members | 1,701 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,317 developers. It's quick & easy.

Gridview: Maintain selected checkbox state while Paging

87
Hi,

I have a gridview with paging option. I want to maintain the state of the checkbox column in gridview for each page.

I used vb.net coding.

I used the following link for this purpose,

http://aspalliance.com/774_Maintaining_State_of_CheckBoxes_While_Paging_i n_a_GridView_Control

It worked properly.

But when i check all the checkbox of page1 in gridview and click the next page, it shows that all checkbox of page2 is checked.

I know the reason for it. Because the index of the gridview row for each page will start from zero only. This causes the problem.

My requirement: I will check 2 checkbox in page1 of gridview and 1 check box in page2. I want to maintain their individual page state checkbox.

Please help me.
Mar 21 '10 #1
2 8383
CroCrew
564 Expert 512MB
Hello Ananthu,

This can be done. But, first lets have you post what you have done so far and then we can add/edit what you have. This way you get the best fit solution to your question.

Happy Coding,
CroCrew~
Mar 24 '10 #2
Frinavale
9,735 Expert Mod 8TB
You need to keep track of what has been selected.
You essentially want to keep track of the unique IDs for each row that has been selected. Please remember that you can Sort a GridView and so you can't just keep track of the indexes...you should use some sort of unique identify for each row.

You will need to store this somewhere.
You could store the selected unique IDs in Session, ViewState, Cookies....a HiddenField...whatever you fancy so long as it is accessible between postbacks.

Every time the user postsback to the server you should update your list of selected unique IDs so that you are always current.

That's pretty much it.

-Frinny
Mar 25 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Paul Hale | last post: by
1 post views Thread by tfsmag | last post: by
reply views Thread by Mike P | last post: by
3 posts views Thread by r.hein | last post: by
9 posts views Thread by mike7510uk | last post: by
reply views Thread by =?Utf-8?B?V0I=?= | last post: by
1 post views Thread by Neven Klofutar | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.