How to use ClearSelection() Method CheckBoxList in ASP.Net C#

In this ASP.Net tutorials we are going to learn How to use ClearSelection() Method CheckBoxList Control Programmatically in ASP.Net with C#.

STEP 1 – Design the ASP.Net web form with One CheckBoxList Control along with the One Button Control:

<table style=”width: 464px”>
<tr>
<td colspan=”1″ style=”width: 257px; height: 24px”>
<strong><span style=”font-size: 14pt; color: #6600cc; font-family: Arial”>ClearSelection()
Method – CheckBoxList</span></strong></td>
</tr>
<tr>
<td style=”width: 257px; height: 24px; text-align: center;”>
&nbsp;
<asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click” Text=”Clear Selection()” Font-Bold=”True” Font-Size=”Medium” /></td>
</tr>
<tr>
<td style=”width: 257px; height: 22px; text-align: center;”>
<asp:CheckBoxList ID=”CheckBoxList1″ runat=”server” Width=”168px”>
</asp:CheckBoxList></td>
</tr>
<tr>
<td style=”width: 257px; height: 22px; text-align: center”>
</td>
</tr>
</table>

The ASP.Net CheckboxList Control ClearSelection() Method output is :

The ASP.Net CheckboxList Control ClearSelection() Methos Example with C#
The ASP.Net CheckboxList Control ClearSelection() Methos Example with C#

STEP 2 – write below code on Button click event on ASP.Net code page:

protected void Page_Load(object sender, EventArgs e)
{
string[] Days = { “Sunday”, “Monday”, “Tusday”, “Wednesday”, “Thursday” };
CheckBoxList1.DataSource = Days;
CheckBoxList1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
CheckBoxList1.ClearSelection();
}

The ASP.Net CheckboxList Control ClearSelection() Method output is :

The ASP.Net CheckboxList Control ClearSelection() Methos Example with C#
The ASP.Net CheckboxList Control ClearSelection() Methos Example with C#

I hope this ASP.Net tutorials CheckboxList Control ClearSelection() Methos Example with C# will help you ….

Leave a Reply

Your email address will not be published. Required fields are marked *