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

5 posts, 0 answers
  1. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 13 Aug 2013 Link to this post

    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?
  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 16 Aug 2013 Link to this post

    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.
  3. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 16 Aug 2013 Link to this post

    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?
  4. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 20 Aug 2013 Link to this post

    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.
  5. Boris
    Boris avatar
    289 posts
    Member since:
    Oct 2012

    Posted 16 Sep 2013 Link to this post

    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.
Back to Top