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

So wierd... RadAjaxManager throwing error w/ MasterPages

6 Answers 146 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 17 Apr 2011, 08:06 AM
Ok...

I stripped my code down to the bare minimum and it still is not working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I am getting Error: i.get_postBackElement() is undefined

Get this, SAME code WORKS when I don't use a MasterPage. When I DO use a MasterPage, it's broken!!!

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage2.master.cs" Inherits="MasterPages_MasterPage2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
    <div>
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
         
        </asp:ContentPlaceHolder>
    </div>
 
    </form>
</body>
</html>
 
using System;
 
public partial class MasterPages_MasterPage2 : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
}

And my aspx page:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage2.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:LinkButton ID="lb1" runat="server" OnClick="lb1_Click" Text="push" />
    <asp:Label ID="lbl1" runat="server" Text="test" />
 
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" UpdatePanelsRenderMode="Inline">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="lb1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbl1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
 
using System;
 
public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void lb1_Click(object sender, EventArgs e)
    {
        lbl1.Text = "pushed";
    }
}

The above doesn't work.

But this WORKS!

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
     
<asp:LinkButton ID="lb1" runat="server" OnClick="lb1_Click" Text="push" />
<asp:Label ID="lbl1" runat="server" Text="test" />
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" UpdatePanelsRenderMode="Inline">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="lb1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="lbl1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
</form>
</body>
</html>
 
using System;
 
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void lb1_Click(object sender, EventArgs e)
    {
        lbl1.Text = "pushed";
    }
}

What gives? :(

I have been using RadControls for many many years. The environment is Windows 7 using .Net 4 integrated mode.

6 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 17 Apr 2011, 04:54 PM
Ok after further tests, I found 3 things that caused this error.

  1. <pages clientIDMode="Static" /> causes this error
  2. AJaxControlToolkit (even with the <scripts> entries in the RadScriptManager
  3. Also I moved the viewstate to the bottom of the page on page "Render"

If at least 1 of those things above were present, the RadAjax was throwing the JS error.

2 and 3 I can live without. But I would really like to use clientIDMode="Static". Any ideas?
0
Robert Poole
Top achievements
Rank 2
answered on 19 Apr 2011, 09:52 PM
I have been pulling my hair out for the last two hours experiencing the same error. After reading Michael's post, I removed a reference to the AJAX Control Toolkit to my project, and presto, it works fine. There is some conflict here. Luckily, I don't need the Toolkit for this project, but Telerik please look into what is causing this.
0
Tsvetina
Telerik team
answered on 21 Apr 2011, 08:33 AM
Hello,

To your questions:

Michael, currently RadControls for ASP.NET AJAX do not offer support for ClientIDMode different than AutoID. Since these are controls with complex hierarchies of child controls and templates, setting their ClientID mode to Static will break their functionality. Please note that Microsoft does not recommend setting ClientIDMode="Static" on pages which do contain dynamic controls.

Robert, there have been some incompatibilities between the RadControls suite and the AjaxControlToolkit which should not be present with the latest versions of both suites. With previous versions, some adjustments were needed, most of them are described in the following forum thread:
AJAX Control Toolkit Compatability

However, if compatibility problems persist on your side, I would advise you to open a formal support ticket and send a runnable sample of your configuration, we will adjust it to work without errors.

Best wishes,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Faten
Top achievements
Rank 1
answered on 04 Feb 2013, 09:59 AM
Micheal , can you please describe in more details point 3 ???? I have the same problem & i'm not using Ajax toolkit nor static client id mode.. i didn't get your third point .. what have you done exactly with viewstate ??
0
Michael
Top achievements
Rank 1
answered on 04 Feb 2013, 11:10 PM
Basically I moved the viewstate to the bottom of the page, and this caused issues. It's a bit of a task to move the viewstate to the bottom so I doubt many people would have done this, but if you happened to have done that, that caused issues.
0
Oliver
Top achievements
Rank 1
answered on 16 Jun 2013, 05:30 PM
Hi all,

I ran into the same problem. Same code not working in nested page, but worked without changes in a standard (non nested) page.

I found a workaround (for me), that could possibly give anybody a helping hand, when facing the same problem.

(My) conclusion:
I replaced every standard asp-control with its corresponding telerik version, which I defined as a trigger in RadAjaxManager.
e.g. asp:button into radButton, asp:DropDownList into radDropDownList ... etc...
After I replaced my controls, everything worked like expected, even within a nested page. I don't know exactly why, but perhaps the support has a guess to share with us?

Best regards
Oliver


Tags
Ajax
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Robert Poole
Top achievements
Rank 2
Tsvetina
Telerik team
Faten
Top achievements
Rank 1
Oliver
Top achievements
Rank 1
Share this question
or