This is a migrated thread and some comments may be shown as answers.

RadButton as CheckBox checked property

2 Answers 551 Views
Button
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 17 Apr 2013, 12:19 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 17 Apr 2013, 04:43 AM
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.
0
Jeff
Top achievements
Rank 1
answered on 17 Apr 2013, 08:41 AM
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
Tags
Button
Asked by
Jeff
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jeff
Top achievements
Rank 1
Share this question
or