New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Client-side Events

Event log

This example illustrates how to use the client-side API of RadAjaxPanel to implement a simple text editor.

The events used here are: OnRequestStart and OnResponseEnd.
The event handler functions for these are defined as follows:

< ClientEvents OnResponseEnd = "OnResponseEnd" OnRequestStart = "OnRequestStart" ></ ClientEvents >

The OnRequestStart event fires just before the XmlHttpRequest is sent to the server. In this example, the OnRequestStart event is used to disable controls on the form and display status information. Moreover, this example uses the OnRequestStart event to prompt the user to cancel the AJAX request if they wish to.

The OnResponseEnd event fires when the HTML on the page has been updated by an AJAX request. This example uses the OnResponseEnd event to update status information and re-enable form controls to allow the user to continue their work.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • scripts.js
  • styles.css
<%@ Page Language="vb" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.AjaxPanel.ClientSideProgramming.ClientEvents.DefaultVB" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-wide no-bg">
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript" src="scripts.js"></script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnResponseEnd="responseEnd" ClientEvents-OnRequestStart="requestStart">
            <div class="messageWrapper">
                <div class="buttonsContainer">
                    <telerik:RadButton RenderMode="Lightweight" Text="Send Message" OnClick="sendMessage_Click" runat="server" ID="sendMessage" Skin="Silk"></telerik:RadButton>
                    <telerik:RadButton RenderMode="Lightweight" Text="Save Draft" OnClick="saveDraft_Click" runat="server" ID="saveDraft" Skin="Silk"></telerik:RadButton>
                    <telerik:RadButton RenderMode="Lightweight" Text="Restore Draft" OnClick="restoreDraft_Click" runat="server" ID="restoreDraft" Skin="Silk"></telerik:RadButton>
                </div>
                <telerik:RadTextBox RenderMode="Lightweight" ID="txtBody" Text="Type here..." runat="server" TextMode="MultiLine" Rows="100" Columns="20" CssClass="messageContent" Skin="Default"></telerik:RadTextBox>
                <asp:Label ID="statusLabel" runat="server" CssClass="statusText"></asp:Label>
            </div>
        </telerik:RadAjaxPanel>
    </div>
    <qsf:EventLogConsole runat="server" ID="EventLogConsole1"></qsf:EventLogConsole>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance