Checked state text.

2 posts, 0 answers
  1. Katya
    Katya avatar
    21 posts
    Member since:
    May 2013

    Posted 27 Aug 2013 Link to this post

    I use a checkbox radbutton with two togglestates. From javascript how can I retrieve the checked state text? Please help.

    Thanks
    Katya
  2. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 28 Aug 2013 Link to this post

    Hi,
    Please use the below javascript function to get the text
    Javascript
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
            <script type="text/javascript">
                function GetToggleText() {
                    var button = $find('<%=btnToggle.ClientID %>');
                    if(button.get_selectedToggleState().get_index() == 0)
                    {
                        var text = button.get_selectedToggleState().get_text();
                        alert(text);
                    }
     
                     
                }
            </script>
        </telerik:RadScriptBlock>

    HTML MarkUp
    <telerik:RadButton ID="btnToggle" runat="server" OnClientCheckedChanged="GetToggleText"
                ToggleType="CheckBox" ButtonType="LinkButton">
                <ToggleStates>
                    <telerik:RadButtonToggleState Text="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked" />
                    <telerik:RadButtonToggleState Text="UnChecked" PrimaryIconCssClass="rbToggleCheckbox" />
                </ToggleStates>
            </telerik:RadButton>
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top