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

RadAjaxManager not working as expected

1 Answer 289 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Felix
Top achievements
Rank 1
Felix asked on 20 Oct 2008, 11:57 PM
Hey there!
As I'm from Germany, please excuse some Errors in your wonderful language :-)

I have the following problem:
I'm in train to ajaxify a fairly complex project with a masterpage and several stacked UserControls.

For this purpose and the Idea to ajaxify specific Controls through the code, I programmed a codepiece to add AjaxSettings to the AjaxManager on the MasterPage and find the given Controls automatically.
This is working good now except that the most important feature is missing: I find the Control's UniqueIDs, the LoadingPanel is displayed properly and at the right place, but the updated Control is not being updated at all.

If I add the AjaxSettings manually in the ASPX-Page, the Update (e.g. updating DateTime.Now) works fine - using the same UniqueIDs that are calculated in my Function SearchControl as follows.

In the following Codeblock, the CodeBehind-File of the Masterpage is shown, in which the functions are executed.

Can you explain, why this function produces a working Site with working LoadingPanels but without a working UpdatedControl?
Thanks so much in advance,
sincerely yours,
Felix

protected void Page_Load(object sender, EventArgs e) 
    { 
        AddAjaxSettings(this.Page, "Button1""TimeLabel""RadAjaxLoadingPanel1"); 
 
    } 
    protected void AddAjaxSettings(Control parent, string InitiateControl, string UpdatedControl, string LoadingPanel) 
    { 
        InitiateControl = SearchControl(parent, InitiateControl); 
        UpdatedControl = SearchControl(parent, UpdatedControl); 
        LoadingPanel = SearchControl(parent, LoadingPanel); 
        AjaxSetting AS1 = new AjaxSetting(InitiateControl); 
        AS1.UpdatedControls.Add(new AjaxUpdatedControl(UpdatedControl, LoadingPanel)); 
        RadAjaxManager.GetCurrent(Page).AjaxSettings.Add(AS1); 
    } 
 
    protected string SearchControl(Control parent, string ControlToSearch) 
    { 
        string output = ""
        if (parent.HasControls()) 
        { 
            foreach (Control c in parent.Controls) 
            { 
                if (c.UniqueID.ToString().EndsWith(ControlToSearch) == true
                { 
                    output = c.UniqueID; 
                    break
                } 
                else 
                { 
                    output = SearchControl(c, ControlToSearch); 
                    if (output != ""break
                } 
            } 
            return output; 
        } 
        else return output; 
    } 

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 21 Oct 2008, 12:10 PM
Hello Felix,

Note that you need the ID of the control when adding ajax settings programmatically but not the UniqueID. You can find more about programmatically adding ajax settings here.

In addition, mind that you can add the necessary settings from the user controls' code behind but adding the all from the master page.

More information about RadAjax and MasterPage is available in the following resources:
http://www.telerik.com/help/aspnet-ajax/ajxajaxmasterpage.html
http://www.telerik.com/help/aspnet-ajax/ajxusercontrols.html
http://www.telerik.com/help/aspnet-ajax/ajxmasterpageupdateeverywhere.html

Give it a try and let me know if I can assist you further.

Regards,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Felix
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or