I have a RadTabStrip and a RadMultiPage as in the “Load on demand” example.
I need a page where content in the selected tab loads/reloads when the tab is selected, and only the content in the selected tab.
- If the user clicks on tab A -> content in the user control in tab A must load/reload
- If the user clicks on tab B -> content in the user control in tab B must load/reload (do not reload the usercontrol in tab A).
In the example “Load on demand” the user controls only loads when the tab is clicked for the first time.
How do I modify the “Load on demand” example to fit my needs?
6 Answers, 1 is accepted
Actually, this is the idea of the Load On Demand example - the pageviews' content is loaded only when the tab is clicked for the first time.
You could easily achieve your goal by simple setting the multipage's RenderSelectedPageOnly property to True. Please note that in order to use the RenderSelectedPageOnly property of the multipage, you have to set the AutoPostBack property of the tabstrip to True as well.
In addition, please note that RadTabstrip always reloads all of its pageviews. The RenderSelectedPageOnly property does just that - it renders only the selected page view; the code-behind of your page / UserControls will be fired no matter which pageview is rendered. Loading all pageviews is essential for the server controls living in the page views. If we don't load them every time viewstate will be corrupted and postback events won't fire.
the Telerik team
Thanks for your quick response!
It seems like my view state gets corrupted when I select RenderSelectedPageOnly. I’m not sure if this was exactly what you meant or if there is a workaround?
The reason why we want to only load the selected tab is that the page is very heavy. Do you have any other ideas?
I think the best way to proceed is to open a support ticket and send us a simple running project illustrating the problem. We will test it locally and try to find a solution.
the Telerik team
let me refrase. I can load my usercontrols dynamically by clicking the tabs in the tabgroup.
The trouble is that the functionality of the loaded usercontrol does not behave as expected (ie. image buttons in a radgrid row or a image button on the usercontrol) when I load the usercontrol dynamically.
However, if I add all usercontrols (to the page) that later are loaded/executed/filled with data by clicking the tab, the functionality of the usercontrol is intact when the usercontrol is loaded.
What I'm after is reducing the html footprint of the page by only loading the usercontrols when tab is selected.
It this possible?
Also I found out that if I set the ”EnableViewStat=true” property on the radgrid I get this error when sorting columns:
An error has occurred because a control with id 'ctl00$x$ucCustComments$rg$ctl01$ctl02$ctl01$ctl02' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
If you are implementing custom loading of user controls (without using the PageViewCreated event) you should make sure you are always loading the user control (on every page_load). If you load it only during the TabClick event the user control will be lost after postback (ajax request). Providing any additional information about your scenario (e.g. sample code) will help us better understand your scenario.
the Telerik team