New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnAjaxRequest
The AjaxRequest
event occurs when triggered by the client-side ajaxRequest()
function or the server-side `RaisePostBackEvent()`` method.
The event cannot be cancelled. The AjaxRequest
event handler receives a single string argument.
The example below demonstrates an AjaxRequest
triggered from both the client and server. An a HTML input button and a standard ASP.NET button are also defined. The HTML input button triggers a function that calls the client-side ajaxRequest()
. The ASP.NET button triggers a server-side OnClick
event that in turn calls the RaisePostBackEvent()
method.
ASP.NET
<form id="form1" runat="server">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
</telerik:RadAjaxManager>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function clientClick() {
var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");
ajaxManager.ajaxRequest("client");
}
</script>
</telerik:RadCodeBlock>
<div>
<asp:Button ID="btnServer" runat="server" Text="Make server AjaxRequest" OnClick="btnServer_Click" />
<input id="btnClient" type="button" value="Make client AjaxRequest" onclick="clientClick();" />
</div>
</form>