This is a migrated thread and some comments may be shown as answers.

RadControls and page-lifecycle

1 Answer 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 10 Sep 2008, 09:51 AM
Hi,

my question is not directly related to rad controls but I dare to ask it anyway :).
How do I preserve the state of a control over multiple requests? For example:

I have two RadGrids on my page. The first shows all available objects of some type
while the other one shows the selected objects. When I click the add-button in the first
grid, an object representing this row is added to an ArrayList (server side) which is a member variable of the page object.
The second grid is bound to that ArrayList. Now, the problem is when I click on a line for the second time, the ArrayList is empty again because the page object is re-created.
So what would be the best solution to preserve this ArrayList?

Many thanks in advance for your sugestions.
Best Regards,
Robert  

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 10 Sep 2008, 10:27 AM
Hello Robert,

You can store the ArrayList in Session/ViewState or Cache object and retrieve it from there on subsetquent postbacks in order to add more items to it. Review the sample project from the code library thread linked below for more details:

http://www.telerik.com/community/code-library/submission/b311D-bkhmgg.aspx

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Robert
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or