473,513 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview: Maintain selected checkbox state while Paging

87 New Member
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 8618
CroCrew
564 Recognized Expert Contributor
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 Recognized Expert Moderator Expert
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

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

Similar topics

4
3853
by: Paul Hale | last post by:
Hi, Currently using VS2005 c# Scenario: I have a gridview control displaying many items with paging enabled. Column is a checkbox column which users can check, but when the gridview is paged to...
1
6999
by: tfsmag | last post by:
Hello, I have a function that returns a dynamically created gridview. This works fine, however it does not seem to be able to maintain state when adding sorting or paging to the gridview. Does...
0
1249
by: Samy | last post by:
Hi There, I have a grid view which has paging enabled in it. One of the colums is a check box and checkbox selections shows a subset of rows a user has selected from available rows. I need to...
0
2465
by: Mike P | last post by:
I am trying to edit a gridview while using paging, but whenever I try to edit a row on a page other than page 1, I get an error. Here is my gridview and my code : <asp:GridView ID="GridView1"...
3
6582
by: r.hein | last post by:
I've got a middle tier data object that I'm binding a gridview to, and I'm having some problems with the check box, and having it enabled. Let'd start with the middle tier object (and the...
9
5522
by: mike7510uk | last post by:
Hi, I am using a gridview with a templatefield containing a checkbox. I want to update the database with a 1 or 0 depending on if a checkbox is checked or unchecked (then use the 1 or 0 later on...
0
4188
by: =?Utf-8?B?V0I=?= | last post by:
Hi, I have a .NET page which has a gridview of customers from Northwind database. There's a checkbox for each customer and the gridview allows paging. I would like to be able to persist the...
1
3661
by: Neven Klofutar | last post by:
Hi, I have a questin regarding GridView, Template column and Checkbox in it. I'm working on a project that has several "client" applications entering data into DB, and one "admin" application...
2
4739
by: dixonjm | last post by:
I have quite a complicated problem with the above. I will do my best to explain, although I have a word doc (too large to attach here 149KB) with the problem explained full with screen shots if any...
0
4640
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7099
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5685
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.