"Custom Toggle Button" visually respond to code behind?

2 posts, 0 answers
  1. darren
    darren avatar
    1 posts
    Member since:
    Feb 2014

    Posted 14 Feb 2014 Link to this post

    If a RadButton is set to true in the code behind as being selected (with no actual click event or click activity) does it always visually manifest as being "selected".  Meaning does it visually toggle back and forth in response to code-behind operations like ".Checked"=true?

    Would this be accomplished with the "OnToggleStateChanged"?  Perhaps changing the state manually?

    The standard AJAX components I'm working with the Visual Studio don't seem to update themselves in response to code behind and seem to require some JavaScript which I'm trying to avoid.

    Thanks in advance for any help...
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Feb 2014 in reply to darren Link to this post

    Hi darren,

    I guess that you want to select a ToggleButton state from the server side. Please have a look into the following code snippet which works fine at my end.

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" ButtonType="StandardButton" ToggleType="CustomToggle" OnToggleStateChanged="RadButton1_ToggleStateChanged">
        <ToggleStates>
            <telerik:RadButtonToggleState Text="Selected"></telerik:RadButtonToggleState>
            <telerik:RadButtonToggleState Text="UnSelected"></telerik:RadButtonToggleState>
        </ToggleStates>
    </telerik:RadButton>

    C#:
    protected void RadButton1_ToggleStateChanged(object sender, ButtonToggleStateChangedEventArgs e)
    {
        //set togglestate
        RadButton1.SetSelectedToggleStateByText("UnSelected");
    }

    Please elaborate your requirement if it doesn't help.
    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top