A simple WebForm contains a user control with a RadAjaxPanel.
The user control contains a button that is supposed to fire the ajaxRequest method of the RadAjaxPanel and update a simple label... but it doesn't!
The function ajaxRequest is indeed called, but the label is never updated.
Source code:
Test.aspx
The user control contains a button that is supposed to fire the ajaxRequest method of the RadAjaxPanel and update a simple label... but it doesn't!
The function ajaxRequest is indeed called, but the label is never updated.
Source code:
Test.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %> |
<%@ Register src="AjaxControl.ascx" tagname="AjaxControl" tagprefix="uc1" %> |
<!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>Test</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<asp:ScriptManager ID="ScriptManager1" runat="server"> |
</asp:ScriptManager> |
<asp:Label ID="Label1" runat="server" Text="Click on the button..."></asp:Label><br /> |
<uc1:AjaxControl ID="AjaxControl1" runat="server" /> |
</div> |
</form> |
</body> |
</html> |
AjaxControl.aspx:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AjaxControl.ascx.cs" Inherits="AjaxControl" %> |
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
<script type="text/javascript"> |
function InitiateAsyncRequest(argument) |
{ |
var ajaxPanel = $find("<%=RadAjaxPanel1.ClientID%>"); |
ajaxPanel.ajaxRequest(argument); |
} |
</script> |
</telerik:RadCodeBlock> |
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="InitiateAsyncRequest('New Text')" /> |
<telerik:RadAjaxPanel ID="RadAjaxPanel1" |
runat="server" Height="200px" Width="300px" OnAjaxRequest="RadAjaxPanel1_AjaxRequest"> |
<asp:Label ID="Label1" runat="server" Text="...and this text will change!"></asp:Label> |
</telerik:RadAjaxPanel> |
AjaxControl.aspx.cs:
using System; |
using System.Collections; |
using System.Configuration; |
using System.Data; |
using System.Linq; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.HtmlControls; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Xml.Linq; |
public partial class AjaxControl : System.Web.UI.UserControl |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
protected void RadAjaxPanel1_AjaxRequest(object source, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
Label1.Text = e.Argument; |
} |
} |