
Daron Quick
Top achievements
Rank 1
Daron Quick
asked on 27 Feb 2009, 05:11 PM
I am able to dynamically load a user control per the information found in the following link...
http://www.telerik.com/help/aspnet-ajax/ajxloadusercontrols.html
The problem I am having with this is...
My User Control contains a Tab Strip and Multi-Page.
Each Page of the Multi-Page control contains a Rad Grid..
The Rad Grids in each Page contains a Child Grid (or dataGrid)
This appears to create a problem.. as the instructions in the link above reload the user control.
When + sign is clicked to expand or contract the Child grid.. then the control re-loads...
This reverts the Page View back to the default page displaying the first grid that loads...
Any assistance with this would be great.
Thanks.
5 Answers, 1 is accepted
0

BILLY ALLEN
Top achievements
Rank 1
answered on 27 Feb 2009, 10:21 PM
Daron,
I too have been struggling with the same types off issues: grid events not firing, user controls not being visible, or tabstrips not clickable.
I've found that a lot of my problems are related to the fact that they exist within a RadMultiPage. The things that help me a lot are:
1. Setting the RadTabStrip.AutoPostBack = true
2. Setting RadMultiPage.RenderSelectedPageOnly = true
if you are using Ajax, which I suspect you are (otherwise you won't run into a lot of these problems!), then you should be able to handle the screen flash/update issues pretty easily,
I was about to toss our Telerik entirely until I stumbled on this. Unfortunately, I had to discover it myself! Hopefully it will save you some grief.
I too have been struggling with the same types off issues: grid events not firing, user controls not being visible, or tabstrips not clickable.
I've found that a lot of my problems are related to the fact that they exist within a RadMultiPage. The things that help me a lot are:
1. Setting the RadTabStrip.AutoPostBack = true
2. Setting RadMultiPage.RenderSelectedPageOnly = true
if you are using Ajax, which I suspect you are (otherwise you won't run into a lot of these problems!), then you should be able to handle the screen flash/update issues pretty easily,
I was about to toss our Telerik entirely until I stumbled on this. Unfortunately, I had to discover it myself! Hopefully it will save you some grief.
0
Hello guys,
If you ensure that the user controls are loaded dynamically in par with the concepts from the linked help topic as well as this one for RadGrid:
http://www.telerik.com/help/aspnet-ajax/grdusercontrolruntimeload.html
this should be sufficient that the viewstate/lifecycle of these user controls as well as the controls wrapped inside them will remain consistent/intact.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
If you ensure that the user controls are loaded dynamically in par with the concepts from the linked help topic as well as this one for RadGrid:
http://www.telerik.com/help/aspnet-ajax/grdusercontrolruntimeload.html
this should be sufficient that the viewstate/lifecycle of these user controls as well as the controls wrapped inside them will remain consistent/intact.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Daron Quick
Top achievements
Rank 1
answered on 03 Mar 2009, 05:33 PM
Ok... I am making progress with this.. but now I am having the following issue...
I dynamically load a user control into Panel1, well call it 'ControlA'
'ControlA' contains a multipage view with rad grids, the rad grids have nested or child grids.
At this point everything seems to work ok, Clicking on the '+' next to rows in the grid properly expand the child grid.
Then I clear the panels controls using 'Panel1.Controls.Clear()'
Then dynamically load a different control into Panel1,
'ControlB' also contains a multipage view with rad grids, the rad grids have nested or child grids.
At this point the control seems to load ok... but when I click on the '+' sign on a row in the grid... I get the following error....
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
I dynamically load a user control into Panel1, well call it 'ControlA'
'ControlA' contains a multipage view with rad grids, the rad grids have nested or child grids.
At this point everything seems to work ok, Clicking on the '+' next to rows in the grid properly expand the child grid.
Then I clear the panels controls using 'Panel1.Controls.Clear()'
Then dynamically load a different control into Panel1,
'ControlB' also contains a multipage view with rad grids, the rad grids have nested or child grids.
At this point the control seems to load ok... but when I click on the '+' sign on a row in the grid... I get the following error....
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
0

Daron Quick
Top achievements
Rank 1
answered on 03 Mar 2009, 08:12 PM
I should Add that I am doing one thing different, which may be creating the problem.
In addition to loading an initial control in the Page_Load event...
I am also reloading controls on the Rad Menu ItemClick event.
protected void RadMenu1_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e) |
{ |
panel1.controls.Clear(); |
string sCtlName= e.Item.Value.ToString(); |
UserControl ctlToLoad = LoadControl(sCtlName); |
ctlToLoad.ID = sCtlName; |
panel1.Controls.Add(ctlToLoad); |
} |
If this causing the problem... then would there be a different way to dynamically load the control based on the value of the clicked menu item?
0
Hello Daron,
Judging from the exception message, the second dynamically loaded user control viewstate seems to be corrupted and most probably your mechanism for runtime load is not in par with the concepts explained so far.
Can you please revise your logic to see whether this helps? If you are unable to solve the issue yourself, isolate a stripped working version of your project, demonstrating the erroneous behavior, and send it enclosed to a regular support ticket. We will test/debug it locally and will get back to you with our findings.
Regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Judging from the exception message, the second dynamically loaded user control viewstate seems to be corrupted and most probably your mechanism for runtime load is not in par with the concepts explained so far.
Can you please revise your logic to see whether this helps? If you are unable to solve the issue yourself, isolate a stripped working version of your project, demonstrating the erroneous behavior, and send it enclosed to a regular support ticket. We will test/debug it locally and will get back to you with our findings.
Regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.