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

Not quite sure what I'm doing - dynamic loading of ASCXs

4 Answers 20 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 13 Aug 2013, 03:04 PM
I have a page with a relatively conventional RadTabStrip/RadMultipage/RadPageView set up.   I also have a RadAjaxManager setup so that for certain values of a RadComboBox in the first RadPageView (the first tab), a second tab becomes visible.  So far, so good.

Up till now I've had three ASCXs in the second RadPageView and I've manipulated them through Ajax so that they're visible when needed.

What I would like to do (given that the number of ASCXs may increase) is dynamically load them instead.

For my load I'm doing the following:

Control1 = (ControlType1)this.LoadControl("Control1.ascx");
Then I do a
Panel1.Controls.Add(Control1);

I've tried a number of variations including putting the control in an ASP:Panel in the 2nd RadPageView.  Display is not a problem but when it comes time to save, the Find for the control always returns null.   

What would be the best approach for a situation like this?

4 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 16 Aug 2013, 07:27 AM
Hello Boris,

Please check out the following online example which elaborates on how to load dynamically user controls and ajaxify them:
http://demos.telerik.com/aspnet-ajax/ajax/examples/common/loadingusercontrols/defaultcs.aspx

I hope this helps.

Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Boris
Top achievements
Rank 1
answered on 16 Aug 2013, 12:27 PM
Do I understand correctly?  For a scheme like this to work, assuming use of a RadAjaxManager, all controls involved in the dynamic load have to be within the same ajaxified asp:panel?
0
Radoslav
Telerik team
answered on 20 Aug 2013, 07:12 AM
Hi Boris,

It is not obligatory to wrap the entire content into the RadAjaxPanel, however if you have RadMultiPage and RadTabStrip controls the only possible approach is to add the whole MultiPage in the RadAjaxManager settings or wrap the whole control into RadAjaxPanel. More information and example you can find here:
http://www.telerik.com/help/aspnet-ajax/ajax-tips-and-tricks.html
Please give it try and let me know if it helps you.
Additionally if this does not help, can you please post your aspx page markup with the related code behind code. Thus we will be able to gather more details about your scenario and provide you solution.

Looking forward for your reply.

Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Boris
Top achievements
Rank 1
answered on 16 Sep 2013, 12:59 PM
I suspect that given the nature of the web pages in which I'm using these ASCXs, I am going to have to seriously re-think the basic design of the pages.

Unfortunately I don't have any time to pursue this since another project has suddenly taken top priority.

If I'm ever allowed time to figure this out, I'll let you know.  

Thanks for all the references.
Tags
General Discussions
Asked by
Boris
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Boris
Top achievements
Rank 1
Share this question
or