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

RadAjaxManager throwing Sys is undefined in 1 of 2 scenarios

1 Answer 124 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 05 Apr 2012, 01:09 AM
I am at a total loss, no matter what I do, one of these two scenarios will throw a Sys is undefined error while utilized the RadAjaxManager:

My two scenarios, what they have in common:
    I have a Master Page, on that Master Page I have a RadAjaxManager.

   Scenario 1: I have a content page where User Controls are Dynamically Added to the Page and inside of the UserControls I reference the SharedAjaxManager and AddAjaxSettings for controls within my custom USer Controls

   Scenario 2: I have a simple content page with Telerik Controls on It.

No matter how I define the RadAjaxManager it will ALWAYS fail one of these two scenarios when i try to ajaxify controls

I tried Defining it in the 3 following ways (2 ways are Programmatically in the Master Page, 1 way is By putting it in the MasterPage Markup)

protected override void OnInit(EventArgs e)
       {
           base.OnInit(e);
           if (MasterAjaxManager == null)
           {
               Telerik.Web.UI.RadAjaxManager SharedAjaxManager = new Telerik.Web.UI.RadAjaxManager();
               SharedAjaxManager.ID = "SharedAjaxManager";
              SharedAjaxManager.DefaultLoadingPanelID = RALP.UniqueID;
               form1.Controls.Add(SharedAjaxManager);
           }
public Telerik.Web.UI.RadAjaxManager MasterAjaxManager
       {
           get { return (Telerik.Web.UI.RadAjaxManager)this.form1.FindControl("SharedAjaxManager"); }
        }
       }

I also tried defining by:
protected void Page_Init(object sender, EventArgs e)
        {
           Telerik.Web.UI.RadAjaxManager SharedAjaxManager = new Telerik.Web.UI.RadAjaxManager();
            SharedAjaxManager.ID = "SharedAjaxManager";
            SharedAjaxManager.DefaultLoadingPanelID = RALP.UniqueID;
            this.Page.Form.Controls.Add(SharedAjaxManager);
        }
  
       public Telerik.Web.UI.RadAjaxManager MasterAjaxManager
        {
            get { return Telerik.Web.UI.RadAjaxManager.GetCurrent(Page); }
        }

And by:
<telerik:RadAjaxManager ID="SharedAjaxManager" runat="server" DefaultLoadingPanelID="RALP">
        </telerik:RadAjaxManager>
  
        public Telerik.Web.UI.RadAjaxManager MasterAjaxManager
        {
            get { return SharedAjaxManager; }
        }


And in each case where I ajaxify Controls I do this: (i tried referencing it through my own way and by RadAjaxManager.GetCurrent(Page) //I also tried using RadAjaxManagerProxy and setting it in the aspx page, but it still throws the same error
protected void Page_Load(object sender, EventArgs e)
        {
                         RegisterAjaxControls();
  
        }//end of PageLoad
  
 protected void RegisterAjaxControls()
        {
            //Needed to ajaxify this control
            RadAjaxManager manager = SharedAjaxManager;// RadAjaxManager.GetCurrent(Page);
            manager.AjaxSettings.AddAjaxSetting(btnCreateUser, panelEditUserContent);
            manager.AjaxSettings.AddAjaxSetting(cblCompanyFilter, panelEditUserContent);
            manager.AjaxSettings.AddAjaxSetting(rgUsers, panelEditUserContent);
        }


But the problem is.... My User Control way works fine and my controls are ajaxified, but the simpler of the two ways, on just the content page.. it will throw the sys is undefined error....

Why will it only work in one of the two instances?

Thanks,

1 Answer, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 05 Apr 2012, 03:29 AM
Looks like the problem is with ASP Panel, for some reason it's not always guaranteed to be there.
Maybe it has issues with innocuous javascript errors or formatting errors that other controls don't.
I can register every other control on the page with the AjaxManager, just not the ASP Panel, and i've had issues with the ASP Panel in other pages as well....

Oh well, current fix is to not use the ASP Panels.
Tags
Ajax
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Share this question
or