New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Getting Started with the Telerik WebForms CheckBox

The following tutorial demonstrates how to set up a page with a RadCheckBox control and use its OnCheckedChanged server event:

  1. In the default page of a new ASP.NET AJAX-enabled Web Application add a RadCheckBox control:
ASPX
<telerik:RadCheckBox ID="RadCheckBox1" runat="server" />
  1. Set the Text, Value and CommandArgument properties:
ASPX
<telerik:RadCheckBox ID="RadCheckBox1" runat="server" Text="Some Text" Value="0" CommandArgument="arg1" />
  1. To hook to the OnCheckedChanged server-side event of RadCheckBox add an attribute to the main control tag and add the method signature:
ASPX
<telerik:RadCheckBox ID="RadCheckBox1" runat="server" OnCheckedChanged="RadCheckBox1_CheckedChanged" Text="Some Text" Value="0" CommandArgument="arg1" />
C#
protected void RadCheckBox1_CheckedChanged(object sender, EventArgs e)
{

}
  1. Add a Label control to write the information to:
ASPX
<asp:Label ID="Label1" Text="" runat="server" />
  1. Use the CheckedChanged event handler to write information about the checkbox properties:
C#
protected void RadCheckBox1_CheckedChanged(object sender, EventArgs e)
{
	RadCheckBox checkbox = sender as RadCheckBox;

	string data = string.Format("current text: {0}, current value {1}, current command argument: {2}, checked: {3}",
								checkbox.Text, checkbox.Value, checkbox.CommandArgument, checkbox.Checked);
	Label1.Text = data;
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support