Dynamica PageView Creation with Single User Control

Purushothama

I am using RadTabStrip. I am dynamically adding PageView on Tab Click. Now, in every pageVirew i am trying to load a single usercontrol containing a Rad Grid with different Data Source based on the tab Name.

I am able to load the user control, but the problem is after clicking all (3) tabs when i open the previous tabs, i have RadGrid with latest data.Since i am using the same usercontrol(with rad grid), same data is loaded in all the tabs.

As per my requirement, I want the previous tabs with the corresponding loaded data. Could you please provide your feedback on this ?

On each tab click, all the usercontrol instances which are dynamically added are binding with the same data source. For example By default Request1 tab will be loaded (data is fine here). If I click on the next tab i.e. Request2, even user control which is there in Request1 also will be binded with the Request2 DataSource.

Veselin Tsvetanov

The problem in this implementation is the fact that each time a postback occurs the Page_Load method for all of the RequestUserControls gets called. Therefore, on each postback the DataSource for the Grid in the RequestUserControls is changed, according to the last selected Tab.

I would suggest you to perform a check in this Page_Load method, confirming that the Grid on the RequestUserControl being loaded does not have a DataSource set. If it already has, you simply do not bind the Grid again.

Attached you will find a simple implementation of the above, replacing the Grid with a simple RadLabel control. It implements the above logic which would be applicable for your scenario.

Regards,
Veselin Tsvetanov
Telerik by Progress

Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.