Three-State Checkbox - only two states when clicking?

4 posts, 0 answers
  1. JP
    JP avatar
    120 posts
    Member since:
    Aug 2011

    Posted 07 Dec 2012 Link to this post

    Hello,

    I added some three-state checkboxes like in the demo:

    <telerik:RadButton ID="btnToggle" runat="server" ToggleType="CustomToggle" ButtonType="ToggleButton">
     <ToggleStates>
      <telerik:RadButtonToggleState Text="UnChecked" PrimaryIconCssClass="rbToggleCheckbox" />
      <telerik:RadButtonToggleState Text="Filled" PrimaryIconCssClass="rbToggleCheckboxFilled" />
      <telerik:RadButtonToggleState Text="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked" />
     </ToggleStates>
    </telerik:RadButton>

    This works fine, but I want to disable the "Filled" state when clicking.
    I want to set all three states server-side, but the user shouldn't be able to use the "Filled" state - he should be able to just switch between "unchecked" and "checked".

    How can I achieve this?

    Thanks!
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1494 posts

    Posted 11 Dec 2012 Link to this post

    Hello,

    There aren't any properties for setting the visibility of RadButtonToggleState in RadButton. However you can dynamically add/remove ToggleStates when needed.

    I have created a simple VS example showing how to add/remove filled ToggleState through clicking on the adjacent RadButton and retaining the state in CommandName property. If the example provided does not fulfill your requirements, could you please explain what exactly is your scenario?

    All the best,
    Danail Vasilev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. SK
    SK avatar
    3 posts
    Member since:
    Jun 2014

    Posted 08 Jul 2014 in reply to Danail Vasilev Link to this post

    Hi Danial,

    Even I have the same situation as JP. Is there any property to disble the filled state from clicking. I just need only checked and unchecked states for the user to click. Can you please help me.

    Thanks,
    SK.
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Jul 2014 in reply to SK Link to this post

    Hi SK,

    I guess you need only two states for the ToggleButton, Checked and Unchecked. Please modify the above ASPX code snippet as follow which will show only two toggle state.

    ASPX:
    <telerik:RadButton ID="rbtnToggle" runat="server" ToggleType="CustomToggle" ButtonType="ToggleButton">
        <ToggleStates>
            <telerik:RadButtonToggleState Text="UnChecked" PrimaryIconCssClass="rbToggleCheckbox" />
            <telerik:RadButtonToggleState Text="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked" />
        </ToggleStates>
    </telerik:RadButton>

    Please elaborate your requirement if it doesn't help.
    Thanks,
    Shinu.
Back to Top