Button - Server-side Events

Event log

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

RadButton exposes several server-side events that allow easy and flexible use in a wide range of application scenarios:

  • OnClick—raised when the RadButton is clicked and AutoPostBack=true.
  • OnCommand—raised when the RadButton is clicked and AutoPostBack=true. It is useful for handling commands (using the CommandName and CommandArgument properties).
  • OnCheckedChanged—raised when the Checked property of the RadButton, with ButtonType=ToggleButton, is changed.
  • OnToggleStateChanged—raised when the Selected property of the RadButton, with ButtonType=ToggleButton, is changed.
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.Web.Examples.ServerSideEvents.DefaultCS" %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!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>Telerik ASP.NET Example</title>
</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-thin">
        <telerik:RadButton RenderMode="Lightweight" ID="btnStandard" runat="server" Text="Standard Button" CommandName="Play"
            OnClick="Button_Click" OnCommand="CommandBtn_Click">
        </telerik:RadButton>
        <div style="padding: 5px">
        </div>
        <telerik:RadButton RenderMode="Lightweight" ID="btnCheckBox" runat="server" ButtonType="ToggleButton" ToggleType="CheckBox"
            Text="CheckBox Button" CommandName="Play" OnClick="Button_Click" OnCommand="CommandBtn_Click"
            OnCheckedChanged="Check_Clicked">
        </telerik:RadButton>
        <div style="padding: 5px">
        </div>
        <telerik:RadButton RenderMode="Lightweight" ID="RadButton1" runat="server" ButtonType="LinkButton" ToggleType="CustomToggle"
            Text="CustomToggle Button" CommandName="Play" OnClick="Button_Click" OnCommand="CommandBtn_Click"
            OnToggleStateChanged="ToggleState_Changed">
            <ToggleStates>
                <telerik:RadButtonToggleState Text="ToggleButton: Mute"></telerik:RadButtonToggleState>
                <telerik:RadButtonToggleState Text="ToggleButton: Low"></telerik:RadButtonToggleState>
                <telerik:RadButtonToggleState Text="ToggleButton: Medium"></telerik:RadButtonToggleState>
                <telerik:RadButtonToggleState Text="ToggleButton: High"></telerik:RadButtonToggleState>
            </ToggleStates>
        </telerik:RadButton>
    </div>
    <qsf:EventLogConsole ID="EventLogConsole1" runat="server" AllowClear="true" Height="300px"></qsf:EventLogConsole>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?