RadButton as CheckBox checked property

3 posts, 1 answers
  1. Jeff
    Jeff avatar
    2 posts
    Member since:
    Mar 2013

    Posted 16 Apr 2013 Link to this post

    Hi Telerik Team,

    I was using a radbutton with toggletype set to checkbox and buttontype as standard button, what I am doing is setting the checked property to true server-side, then if I unchecked it on the UI to set the property to false the radbutton checked property is still set to true though I have unchecked it. 

    Hope you could help me.

    Thanks,
    Jeff
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Apr 2013 Link to this post

    Hi Jeff,

    I am unable to replicate the issue at my end. Please have a look at the following sample code in which I am setting the checked property to true from server side. Later when I uncheck from the UI, it is working as expected.

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" Text="Telerik RadButton" OnClick="RadButton1_Click">
    </telerik:RadButton>
    <br />
    <br />
    <telerik:RadButton ID="btnToggle" runat="server" ToggleType="CheckBox" ButtonType="StandardButton">
        <ToggleStates>
            <telerik:RadButtonToggleState Text="Checked" PrimaryIconCssClass="rbToggleCheckboxChecked" />
            <telerik:RadButtonToggleState Text="UnChecked" PrimaryIconCssClass="rbToggleCheckbox" />
        </ToggleStates>
    </telerik:RadButton>

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        if (btnToggle.Checked == false)
        {
            btnToggle.Checked = true;
        }
        else
        {
            btnToggle.Checked = false;
        }
    }

    Please provide the full code if this didn't help or if you have any other concern.

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeff
    Jeff avatar
    2 posts
    Member since:
    Mar 2013

    Posted 17 Apr 2013 Link to this post

    Hi Princy,

    Thanks for the help. This solved the issue. I encounteread the error because I did not define toggle states under the radbutton, Thank you for your prompt response.

    Kind regards,
    Jeff
Back to Top