This is a migrated thread and some comments may be shown as answers.

Checked state text.

1 Answer 11 Views
Button
This is a migrated thread and some comments may be shown as answers.
Katya
Top achievements
Rank 1
Katya asked on 27 Aug 2013, 09:04 AM
I use a checkbox radbutton with two togglestates. From javascript how can I retrieve the checked state text? Please help.

Thanks
Katya

1 Answer, 1 is accepted

Sort by
0
A2H
Top achievements
Rank 1
answered on 29 Aug 2013, 01:57 AM
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>
Tags
Button
Asked by
Katya
Top achievements
Rank 1
Answers by
A2H
Top achievements
Rank 1
Share this question
or