Using RadAjax

4 posts, 0 answers
  1. phyrom
    phyrom avatar
    11 posts
    Member since:
    Nov 2011

    Posted 23 Feb 2012 Link to this post

    Dear Supporter,

    I'm developing a webpart for SharePoint 2010 by using the RadAjax.

    I have used combination of RadAjaxManager (for master page), RadAjaxManagerProxy (in individual webpart), RadScriptManager (replaced with the <asp:ScriptManager>).

    All controls are being axified as it should work. However, ther is only strange behavior for "THE FIRST TIME hitting any control to be ajaxified to update other controls" the page get refreshed. And for the second time forwards, all controls are being ajaxified as it should work. So, issue only happens for the first time when a control is being updated/clicked.

    Please advise what should be included to make sure it works great since the first time.

    Regards,
    Phyrom
  2. Marin
    Admin
    Marin avatar
    1057 posts

    Posted 24 Feb 2012 Link to this post

    Hi Phyrom,

     When using RadAjaxManager in Sharepoint it is recommended to add the ajax settings in CreateChildControls method of the web part:

    RadAjaxManager ajaxmgr;
            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                ajaxmgr = RadAjaxManager.GetCurrent(Page);
                if (ajaxmgr == null)
                {
                    ajaxmgr = new RadAjaxManager();
                    Page.Items.Add(typeof(RadAjaxManager), ajaxmgr);
                }
     
                if (Page.Form != null)
                {
                    Page.Form.Controls.AddAt(0, ajaxmgr);
                }
                EnsureChildControls();
            }
     
            protected override void CreateChildControls()
            {
                Control control = Page.LoadControl(_ascxPath);
                Controls.Add(control);
     
                RadAjaxLoadingPanel loadingPanel = control.FindControl("RadAjaxLoadingPanel1") as RadAjaxLoadingPanel;
                Button btn = control.FindControl("BtnTestAjax") as Button;
                if (ajaxmgr != null)
                {
                    ajaxmgr.AjaxSettings.AddAjaxSetting(btn, btn, loadingPanel);
                    //add more ajax settings is needed
                }
     
            }

    This way they should be initialized properly and will work the first time as well.

    Kind regards,
    Marin
    the Telerik team
    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 their blog feed now.
  3. phyrom
    phyrom avatar
    11 posts
    Member since:
    Nov 2011

    Posted 25 Feb 2012 Link to this post

    Hi Marin,

    Thank you for  your prompt and helpful response.
     
    I have RadAjaxManagerProxy in each sharepoint webpart and have it configured to ajaxify controls needed in the design time. And I have RadAjaxManager in Sharepoint Master page.

    As per your advise you meant that I need to remove the RadAjaxManagerProxy control and all settings from the webpart, right? and just follow the code provided?

    To make this work, do I need to have RadScriptManager to replace ASP ScriptManager on SharePoint master page?

    Once again thanks for your input.

    Regards,
    Phyrom
  4. phyrom
    phyrom avatar
    11 posts
    Member since:
    Nov 2011

    Posted 25 Feb 2012 Link to this post

    Hi Marin,

    I can manange to get it working now. Awesome!

    Here how I get it to work with your advise.
    1) Remove the RadAjaxManager control from SharePoint master page.
    2) Remove the RadAjaxManagerProxy control from visual  webpart.
    3) optionally add the RadAjaxLoadingPanel
    4) get all your codes in
    5) It just works!

    Thank you for your very helpful input.

    Regards,
    Phyrom
Back to Top