469,621 Members | 1,733 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Repeater with CheckBox and Paging

I am attempting to build a repeating list using a repeater control. I want
to add a checkbox to each item (line) and 'Select All' and 'Clear All'
buttons.

I have figured out how to do this until it comes time to implement paging.

Without paging I can iterate through the repeater when I click 'Select All'
and set the checked property to true for all items in the repeater.

However when I implement paging, I have to rebind the repeater which causes
my selections to go away.

Does anyone have working example code?

Thanks,
Mark
Nov 18 '05 #1
2 4732
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.)

Nov 18 '05 #2
Hi Mark,

I'm reviewing this message and found that you've posted a new thread as:
" Additional Repeater questions for Steven Cheng" on this issue.
And I've replied you in that thread. Do you feel it convenient that we
continue to discuss in that thread?
If you have any questions or need any help, please feel free to post in the
new thread. Thanks.
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.)


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Viktor Popov | last post: by
reply views Thread by Viktor Popov | last post: by
2 posts views Thread by Thomas R | last post: by
7 posts views Thread by charliewest | last post: by
2 posts views Thread by Ceema M via DotNetMonster.com | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.