Hi Mark,
Thanks for posting in the community! My name is Steven, and I'll be
assisting you on this issue.
From your description, you use the repeater control to hold a list of
checkboxes and you implemented your custom paging for the repeater so as to
rebind the repeater with different datas when different page of records if
requested. However, you found that after rebinding the data when paging ,
the checkboxes's value for the previous page will lose. So you 're looking
for some means to remain the checkboxes's state value, yes?
If there is anything I misunderstood, please feel free to let me know.
As for this problem, here is some of my suggestions:
Generally, when we use the list template control to bind and display some
certain collection of datas, if the data's count is very large, we need to
page them. However, since everytime the control is binded and display, only
a certain page's data would be binded and ouput to the user. Then, the
previous page's statues will be lose. So normally, we use the following
means regarding on such problem:
1. Let all the operations which are dependent on the page's status(such as
the checkboxes's checked value) be done right
at or before the paging event happened. That means we will do data
manipulations on every page's data so that if the page changed, the former
data has been successfully dealt, we won't need to store it for further use.
For example:
We have a product lists and every product have a "selected" attribute, we
represent this attribute using a "checkbox" column in Repeater. We may need
to display all the productes in several pages, then everytime page is
changing , we need to do operation to retrieve all the states of the
checkboxes and then update the recored in the datasource(maybe the database
server or other collections in memory)
2. We use some Collections to store the state values on the former page on
the serverside. For example, just the product lists I mentioned above. When
user clicked a page index and change the current page, we retrieve all the
checkboxes' value and then store the value in a array or ArrayList
collection and save it into the Session or Applicatoin area as temp data.
When we need to use it again, then we retrieve it from the Session or
Application. If useless, remove them.
Please consider the above suggestions. I still recommend that you deal with
a certain page's data (state value on page) within the life cyle when it is
the current page since it lose performance if you use serverside memory
(such as Session or application) to store the state datas. How do you think
of it?
If you have any questions or need any other assistance, please feel free to
post here. I'll do some further research to help you.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)