AjaxManagerProxy and Content Areas

6 posts, 0 answers
  1. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 16 May 2011 Link to this post

    The latest controls build seems to break the old solution to the 100% height update panel issue (that of finding the update panel id server-side and setting its height explicitly cliient-side). This breakage is no big deal since I'd like to switch to using the relatively new UpdatePanelHeight property instead of the old hack. However, I have run into an issue. I have a MasterPAge and Contentpage and the latter has two Content Areas. Various controls in each Content are need to ajaxify eachother.

    1) I'd like to place an AjaxManagerProxy declaration on the ContentPage so I can make use of the UpdatePanelHeight property, however, I'm not sure how to reference controls in the two contentAreas in the AjaxSettings.
     
    2) OR, I can also set the ajaxSettings server-side, but then I don't know how to set the UpdatePanelHeight property.

    Can someone let me know how to do either of these.. though #1 is preferrable.

    P.S., it would be nice if you could extend the AddAjaxSetting Method to include a parameter for the UpdatePanelHeight.
  2. Kevin Babcock
    Kevin Babcock avatar
    189 posts
    Member since:
    Mar 2007

    Posted 17 May 2011 Link to this post

    Hi Albert,

    To get a client-side reference to the RadAjaxManager from your content controls, and to get/set Ajax settings, you can use the following code:

    var ajaxManager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
    var settings = ajaxManager.get_ajaxSettings();
    ajaxManager.set_ajaxSetting(settings);

    If you want to get the default loading panel you can use the following code:

    var ajaxManager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
    var id = ajaxManager.get_defaultLoadingPanelID();
    var loadingPanel = $find(id);

    To get a non-default RadAjaxLoadingPanel (one that is tied to a specific AjaxSettings configuration), you can use the following code:

    var ajaxManager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>'),
        settings = ajaxManager.get_ajaxSettings(),
        controlID = '<% MyServerSideControl.ClientID %>',
        updatedControls = null,
        panelID = null,
        loadingPanel = null,
        i = 0,
        j = 0;
    for (i; i < settings.length; i++) {
        updatedControls = settings[i].UpdatedControls;
        for (j; j < updatedControls.length; j++) {
            if (updatedControls[j].ControlID === controlID) {
                panelID = updatedControls[j].PanelID;
                loadingPanel = $find(panelID);
            }
        }
    }

    I hope that helps. Let me know if you need more assistance.

    If this answers your question, please don't forget to mark this post as the answer.

    Regards,
    Kevin
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 17 May 2011 Link to this post

    Thanks for the response, Kevin, but I'm not sure I was clear in my post. I'm trying to figure out how to declaratively set the ajaxsettings so that I can reference controls in two different content areas. At this time I'm not looking to set ajaxsettings using javascript.
  5. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 19 May 2011 Link to this post

    Hello Albert,

    I answered to this in your support ticket, however I am going to post the answer here as well for others to see:

    An ajax setting actually results in an update panel that wraps the ajaxified control and declares the ajax initiator as a trigger control. If you think of AjaxSettings this way, it will be intuitive why they cannot access controls nested in other naming containers (or in separate user controls) when created declaratively.

    As for the UpdatePanelHeight property in code-behind, RadAjaxManager allows adding an AjaxSetting object (using the Add() method). As expected, the AjaxSetting object has a collection of UpdatedControls. When you initialize an UpdatedControl, you can assign it the same properties as the declarative ones:
    Dim updatedControl As New AjaxUpdatedControl() 
    updatedControl.ControlID = "lbl1"
    updatedControl.UpdatePanelHeight = Unit.Pixel(200)


    Greetings,
    Tsvetina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. Albert Shenker
    Albert Shenker avatar
    550 posts
    Member since:
    Mar 2004

    Posted 19 May 2011 Link to this post

    Thanks, I did see that. One thing I would mention, though, is, while it is possible to set the updatepanelheight server side by constructing the updated control, it requires 3 additional lines of code to do this. If you have a lot of AjaxSettings, this casues quite a bit of code bloat. LIke I mentioned, it would be great if Telerik could overload  the AddAjaxSettings method to allow users to specify the UpdatePanelHeight (and UpdatePanelRenderMode) properties in one line.

    Also, on the UpdatePanelRenderMode property. This was a great addition, however, I'm wondering if it would be better if "Inline" were the default, rather than having to set it. I'm not familiar enough with how the update panel is rendered to say whether it would make sense to make it so inline mode were the default, but it might be something to consider.
  7. Tsvetina
    Admin
    Tsvetina avatar
    1876 posts

    Posted 20 May 2011 Link to this post

    Hi Albert,

    To your first concern, like said in the ticket, I consulted our developers on this matter and most probably such overload will be added for the AddAjaxSetting() method.

    As for the UpdatePanelRenderMode property, we did not make Inline the default first because the default for asp UpdatePanel is block and also because it will be a breaking change for all developers who developed their sites with older versions of the controls and now update.

    If you have any further concerns, please post them in the support thread, so that we avoid double-posting on identical issues.

    Greetings,
    Tsvetina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017