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

Using RadAjax

3 Answers 49 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
phyrom
Top achievements
Rank 1
phyrom asked on 23 Feb 2012, 09:19 AM
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

3 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 24 Feb 2012, 06:31 PM
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.
0
phyrom
Top achievements
Rank 1
answered on 25 Feb 2012, 04:35 PM
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
0
phyrom
Top achievements
Rank 1
answered on 26 Feb 2012, 04:38 AM
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
Tags
Ajax
Asked by
phyrom
Top achievements
Rank 1
Answers by
Marin
Telerik team
phyrom
Top achievements
Rank 1
Share this question
or