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

Client-side API

  • Demo Configurator
Client-Side API Commands
  • Enter a URL, e.g., https://www.wikipedia.org/  
  • AutoPostBack

RadButton provides flexible and rich client-side API. Here are some of the key client-side functions:

  • get_text()—returns the text displayed in the RadButton control
  • set_text(text)—sets a text to be displayed in the RadButton control
  • get_autoPostBack() —returns a bool value indicating whether the control will automatically postback to the server
  • set_autoPostBack(true/false)—disables or enables the AutoPostBack behavior of the RadButton control.
  • DefaultCS.aspx
  • scripts.js
<%@ Page Language="C#" AutoEventWireup="true"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <script src="scripts.js" type="text/javascript"></script>
</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="RadButton1" runat="server" Text="Standard Button">
        </telerik:RadButton>
        <div style="padding: 5px">
        </div>
        <telerik:RadButton RenderMode="Lightweight" ID="RadButton2" runat="server" ButtonType="ToggleButton" ToggleType="CheckBox"
            Text="Toggle Button (CheckBox)">
        </telerik:RadButton>
        <div style="padding: 5px">
        </div>
        <telerik:RadButton RenderMode="Lightweight" ID="RadButton3" runat="server" ButtonType="LinkButton" Text="Link Button"
            OnClientClicking="OnClientClicking">
        </telerik:RadButton>
    </div>
    <script type="text/javascript">
        function pageLoad() {
            standardButton = $find("<%=RadButton1.ClientID %>");
            toggleButton = $find("<%=RadButton2.ClientID %>");
            linkButton = $find("<%=RadButton3.ClientID %>");
            txtNavigateUrl = $get("<%=txtNavigateUrl.ClientID %>");
            radWindow = $find("<%=RadWindow1.ClientID%>");
            txtSetButton = $get("<%=txtSetButtonText.ClientID%>");
            addAutoPostBackRadioHandlers();
        }
    </script>
    <qsf:ConfiguratorPanel runat="server">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn runat="server" Title="Client-Side API Commands">
                    <ul class="fb-group">
                        <li>
                            <qsf:TextBox ID="txtSetButtonText" runat="server" Style="width: 150px;" Text="Set Buttons Text"></qsf:TextBox>
                            <qsf:Button runat="server" ID="btnSetText" Text="Set Buttons Text" OnClientClicked="SetButtonsText" AutoPostBack="false"></qsf:Button>
                        </li>
                        <li>
                            <qsf:Button runat="server" ID="btnGetText" Text="Get Buttons Text" OnClientClicked="GetButtonsText" AutoPostBack="false"></qsf:Button>
                        </li>
                        <li>
                            <qsf:Button runat="server" ID="btnGetType" Text="Get Buttons Type" OnClientClicked="GetButtonsType" AutoPostBack="false"></qsf:Button>
                        </li>
                        <li>
                            <span class="label">Enter a URL, e.g., https://www.wikipedia.org/</span>
                            <qsf:TextBox ID="txtNavigateUrl" runat="server" Size="Auto" onchange="trimUrl(this)"></qsf:TextBox>
                            <asp:RegularExpressionValidator ForeColor="Red" Style="padding: 1px 0; width: 0;"
                                ValidationExpression="^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$" runat="server"
                                SetFocusOnError="true" ID="regNavaigateUrl" ControlToValidate="txtNavigateUrl"
                                ValidationGroup="UrlVG" ErrorMessage="Valid URL should start with <strong>http://</strong>"></asp:RegularExpressionValidator>
                        </li>
                        <li>
                            <qsf:Button ID="btnSetNavigateURL" AutoPostBack="false" runat="server" OnClientClicked="SetNavigateUrl"
                                Text="Set Navigate URL (LinkButton only)" ValidationGroup="UrlVG">
                            </qsf:Button>
                        </li>
                        <li>
                            <span class="label">AutoPostBack</span>
                            <qsf:RadioButtonList ID="RadiobuttonlistClientSettings" runat="server" Orientation="Horizontal" CssClass="clientConfigAutoPostback">
                                <asp:ListItem Text="True" Value="1" Selected="true" />
                                <asp:ListItem Text="False" Value="0" />
                            </qsf:RadioButtonList>
                        </li>
                        <li>
                            <qsf:Button runat="server" ID="btnGetToggleType" Text="Get Toggle Type (Toggle Button Only)" OnClientClicked="GetToggleType" AutoPostBack="false"></qsf:Button>
                        </li>
                        <li>
                            <asp:CheckBox ID="cb1" runat="server" onclick="CheckToggleButton();" Text="Check / Uncheck Toggle Button"></asp:CheckBox>
                        </li>
                    </ul>
                    <telerik:RadWindow RenderMode="Lightweight" VisibleOnPageLoad="false" runat="server" Behaviors="Maximize,Close,Move"
                        ID="RadWindow1" VisibleStatusbar="false" Width="700px" Modal="true" Height="500px" Style="z-index: 100001" ShowContentDuringLoad="false">
                    </telerik:RadWindow>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance