How to get RadButton ToggleState text?

3 posts, 1 answers
  1. Erik
    Erik avatar
    43 posts
    Member since:
    Feb 2009

    Posted 23 May 2014 Link to this post

    I'm trying to get the currentToggleState text value of Button/Checkbox from within another javascript function of mine.  If I wire in the online example to get at this value as such things work fine:

    <telerik:RadButton ID="chkboxMaster" runat="server"  OnClientToggleStateChanged="setToggleChange" ToggleType="CheckBox" ButtonType="LinkButton">
    <telerik:RadButtonToggleState Text="Active" Selected="true" PrimaryIconCssClass="rbToggleCheckboxChecked" />
    <telerik:RadButtonToggleState Text="InActive" PrimaryIconCssClass="rbToggleCheckbox" />

    ​function setToggleChange(sender, args) {
                    var tState = args.get_currentToggleState().get_text();  //text value is here

    function WhatIsTheCurrentToggleText()
      //need to get the value here
        var toggleBtn = $find("<%= chkboxMaster.ClientID %>");
        var tv = toggleBtn.get_currentToggleState().get_text();  //no luck
  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 26 May 2014 in reply to Erik Link to this post

    Hi Erik,

    Please try the below JavaScript which works fine at my end.

    function WhatIsTheCurrentToggleText(sender, args) {
        var toggleBtn = $find("<%= chkboxMaster.ClientID %>");

  3. DevCraft R3 2016 release webinar banner
  4. Erik
    Erik avatar
    43 posts
    Member since:
    Feb 2009

    Posted 04 Jun 2014 in reply to Princy Link to this post

    Awesome, was using 'currentToggleState', instead of 'selectedToggleState' as you've shown.  Thanks again Princy
Back to Top