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

RadAjaxManager best practices usage

1 Answer 66 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Hugo
Top achievements
Rank 1
Hugo asked on 10 Jul 2013, 10:40 AM
Hello to all,

Me and my team are very "fresh" in working with Telerik Dev Tools and we are exploring its potencials to see how can we use them in the platform we are developing. We are very excited with the available controls but we have some concerns on the correct usage of the controls and which are the best practices to use them.

Today's doubt is regarding the RadAjaxManager best usage.
Our web platform is using Master Pages to have similar GUI and implement many global functions. Also we have different web controls that can be reused on different pages. These controls can make partial updates and like that needed to be "ajaxified" for Rad Ajax Manager, which is a control we want to use to have more flexibility on the Partial Updates and on the controls that trigger these Updates.
With some quick readings we caught and resolve some issues regarding the usage of ascx with Rad Ajax Manager and the best practice is to register the control programatically. We created a simple method on the Page that receives a Control and register it on the Rad Ajax Manager updating some Panels that are on the same Page. We implemented this approach (see code bellow) with good results.
//this method will be available on each page
public void AjaxifyControl(Control ctrl)
{
    //Add the necessary AJAX setting programmatically
    RadAjaxManager1.AjaxSettings.AddAjaxSetting(ctrl, Panel1);
    RadAjaxManager1.AjaxSettings.AddAjaxSetting(ctrl, Panel2);
    RadAjaxManager1.AjaxSettings.AddAjaxSetting(ctrl, Panel3);
}

But now we have a dillema... With the massive usage of the Telerik Controls we have a "Software Design doubt" about where to put the Rad Ajax Manager?
  1. On the Master Page and like that we only allow to programatically register all the "Ajaxified Controls" with all "Updatable Controls", leaving the register decision for each page, but taking the risk that could be many pages without really needing the RadAjaxManager. We think allowing this by making available a method similar to the one i show bellow: 
    //this method will be available on the Master Page.
    public void RegisterAjaxSetting(Control ajaxifiedCtrl, Control updatedCtrl)
    {
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(ctrl, updatedCtrl);
    }
  2. On all needed Pages (we have this approach right now) having a mix between Markup registered controls (the ones that can be registered thru markup -> basic Page controls) and Programatically registered controls (the ones that exists on the Web User Controls ans need to be added by code), creating a RadAjaxManager on each page that needs a Rad Ajax Manager.

We want to know if exists some documentation that can help us with that or simply which is the best practice that you guys advise.

Many thanks in advance.
Hugo Salgado

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 15 Jul 2013, 11:32 AM
Hello Hugo,

The both options you described are effective enough in case the correct Ajax settings are added on the page.
The best option is to always keep the RadAjaxManager on the MasterPage no matter how the ajax settings will be added. You could use the FindControl() method to locate all the controls which are using the mentioned master page in the application tree and ajaxify them on the MasterPage.
Or another approach could be instead of adding RadAjaxManagerProxy in all other pages just use the RadAjaxManager.GetCurrent() method to get instance of the main manager and continue adding programmatic settings in all independent content pages.
See the online resources below for more information on this matter:
http://www.telerik.com/help/aspnet-ajax/ajax-masterpage-update-everywhere.html
http://www.telerik.com/help/aspnet-ajax/ajax-ajaxmanagerproxy.html

I hope this helps. Do not hesitate to contact us back in case further questions arise.

Regards,
Maria Ilieva
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.
Tags
Ajax
Asked by
Hugo
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or