Checked State
This help article showcases how to check/uncheck the RadCheckBox control on the server-side/client-side.
Get/Set Checked State Server-Side
You can get/set the checked state of the RadCheckBox control on the server-side through the Checked
property.
The
Checked
property takes a nullable boolean. When a null value is set, theChecked
value will default to false. This is useful for data-binding scenarios when theChecked
property is bound to a data source field of nullable boolean type.
<telerik:RadCheckBox ID="RadCheckBox1" runat="server" Text="I agree" Checked="true"></telerik:RadCheckBox>
protected void Page_Init(object sender, EventArgs e)
{
bool isChecked = RadCheckBox1.Checked;
RadCheckBox1.Checked = !isChecked;
}
Protected Sub Page_Init(sender As Object, e As EventArgs)
Dim isChecked As Boolean = RadCheckBox1.Checked
RadCheckBox1.Checked = Not isChecked
End Sub
Get/Set Checked State Client-Side
To get/set the checked state of the RadCheckBox control on the client-side you can use the get_checked()
and set_checked()
properties of the control.
function pageLoad() {
var checkBox = $find("<%=RadCheckBox1.ClientID%>");
var isChecked = checkBox.get_checked();
checkBox.set_checked(!isChecked);
}
<telerik:RadCheckBox ID="RadCheckBox1" runat="server" Text="I agree" Checked="true"></telerik:RadCheckBox>