Before the Prometheus version of RadAjaxManager I could have a page like the following where I emit from the code-behind a client side variable that would reference the client side instance of the RadAjaxManager.
ASPX Code:
Code Behind:
Today, I converted the same code to use the new Prometheus version of RadAjaxManager and I get the following JavaScript error when function TextBoxCustomAjax is called: "Object does not support this property or method".
Here is the code that is using the Prometheus version:
ASPX Code:
Code Behind:
Is there a way to accomplish this same functionality using the Prometheus version of the RadAjaxManager. I can change the line in TextBoxCustomAjax to:
<%=RadAjaxManger1.ClientID %>.AjaxRequest(eventargs);
and that will work, but that is not ideal for my current scenario.
Thanks.
ASPX Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> |
<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
<script type="text/javascript"> |
function TextBoxCustomAjax(eventArgs) |
{ |
ajaxMgr.AjaxRequest(eventArgs); |
} |
</script> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<asp:TextBox ID="TextBox1" onkeyup="TextBoxCustomAjax('TextBox1');" runat="server" /> |
<br /> |
<asp:Label ID="Label1" runat="server" /> |
</div> |
<radA:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableOutsideScripts="true" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<radA:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<radA:AjaxUpdatedControl ControlID="Label1" /> |
</UpdatedControls> |
</radA:AjaxSetting> |
</AjaxSettings> |
</radA:RadAjaxManager> |
</form> |
</body> |
</html> |
Code Behind:
using System; |
using System.Data; |
using System.Configuration; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.ClientScript.IsStartupScriptRegistered("AjaxManager")) |
Page.ClientScript.RegisterStartupScript(Page.GetType(), "AjaxManager", string.Format("var ajaxMgr = {0};",RadAjaxManager1.ClientID), true); |
} |
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
if (e.Argument == TextBox1.ClientID) |
{ |
Label1.Text = TextBox1.Text; |
} |
} |
} |
Today, I converted the same code to use the new Prometheus version of RadAjaxManager and I get the following JavaScript error when function TextBoxCustomAjax is called: "Object does not support this property or method".
Here is the code that is using the Prometheus version:
ASPX Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Untitled Page</title> |
<script type="text/javascript"> |
function TextBoxCustomAjax(eventArgs) |
{ |
ajaxMgr.AjaxRequest(eventArgs); |
} |
</script> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<div> |
<asp:TextBox ID="TextBox1" onkeyup="TextBoxCustomAjax('TextBox1');" runat="server" /> |
<br /> |
<asp:Label ID="Label1" runat="server" /> |
</div> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="Label1" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
</form> |
</body> |
</html> |
Code Behind:
using System; |
using System.Data; |
using System.Configuration; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.ClientScript.IsStartupScriptRegistered("AjaxManager")) |
Page.ClientScript.RegisterStartupScript(Page.GetType(), "AjaxManager", string.Format("var ajaxMgr = {0};",RadAjaxManager1.ClientID), true); |
} |
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
if (e.Argument == TextBox1.ClientID) |
{ |
Label1.Text = TextBox1.Text; |
} |
} |
} |
Is there a way to accomplish this same functionality using the Prometheus version of the RadAjaxManager. I can change the line in TextBoxCustomAjax to:
<%=RadAjaxManger1.ClientID %>.AjaxRequest(eventargs);
and that will work, but that is not ideal for my current scenario.
Thanks.