SelectedToggleStateIndex

4 posts, 1 answers
  1. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 23 Oct 2011 Link to this post

    Hello,

    Could anyone shed some light on the 'SelectedToggleStateIndex' and 'SelectedToggleState' properties??

    It does not do anything here. 'SelectedToggleStateIndex' is always zero.

    <telerik:RadButton ID="rbt_1" ButtonType="LinkButton" GroupName="0001" AutoPostBack="false" UseSubmitBehavior="False" ToggleType="Radio" Text="0-7" runat="server" />
    <telerik:RadButton ID="rbt_2" ButtonType="LinkButton" GroupName="0001" AutoPostBack="false" UseSubmitBehavior="False" ToggleType="Radio" Text="8-27" runat="server" />
    <telerik:RadButton ID="rbt_3" ButtonType="LinkButton" GroupName="0001" AutoPostBack="false" UseSubmitBehavior="False" ToggleType="Radio" Text="28-82" runat="server" />
    <telerik:RadButton ID="rbt_4" ButtonType="LinkButton" GroupName="0001" AutoPostBack="false" UseSubmitBehavior="False" ToggleType="Radio" Text="83-100" runat="server" />

    Thanks,

    Erik
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Oct 2011 Link to this post

    Hello Erik,

    The  SelectedToggleStateIndex property gets or sets the index of the currently selected ToggleState of the RadButton control, when used as a custom toggle button as shown below.
    aspx:
    <telerik:RadButton ID="rbt_1" runat="server" ButtonType="ToggleButton" ToggleType="CustomToggle">
    </telerik:RadButton>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 25 Oct 2011 Link to this post

    Hello Princy,

    Yes, but that is just a radio button. I already had that. :-)

    I think it would be logical that it also returns the selected index when I'm using a button or LinkedButton, don't you think so?

    Erik
  5. Answer
    Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 25 Oct 2011 Link to this post

    Hello Erik,

    In your example you have four different RadButtons on your page, so the ToggleStateIndex will always return 0 because their is no other state contained in the button. The ToggleStateIndex only works if the button is used as a ToggleButton like so:

    <telerik:RadButton ID="RadButton3" runat="server" ButtonType="ToggleButton" Checked="true">
    <ToggleStates>
        <telerik:RadButtonToggleState Text="Checked" Selected="true" />
        <telerik:RadButtonToggleState Text="Unchecked" />
    </ToggleStates>
    </telerik:RadButton>

    As you can see, the toggle states of the RadButton are specified within the button itself and is not multiple button controls.

    You can see it on this demo how the toggle button functionality works:

    http://demos.telerik.com/aspnet-ajax/button/examples/togglebutton/defaultcs.aspx

    I hope that helps.
Back to Top