How to use CheckBoxList OnDataBinding event in ASP.Net C#

In this ASP.Net tutorialswe will teach you, How to use CheckBoxList control OnDataBinding event in ASP.Net C#.

STEP 1 – Design the ASP.Net Web form with one CheckBoxList control one Button control and one Label 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”>OnDataBinding
Event in 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=”View CheckBoxList” Font-Bold=”True” Font-Size=”Medium” /></td>
</tr>
<tr>
<td style=”width: 257px; height: 22px; text-align: center;”>
<asp:Label ID=”Label1″ runat=”server”></asp:Label><asp:CheckBoxList ID=”CheckBoxList1″ runat=”server” OnDataBinding=”CheckBoxList1_DataBinding”
OnDataBound=”CheckBoxList1_DataBound” Width=”168px”>
</asp:CheckBoxList></td>
</tr>
<tr>
<td style=”width: 257px; height: 22px; text-align: center”>
</td>
</tr>
</table>

The ASP.Net CheckboxList Control OnDataBinding Event Example output is :

ASP.Net CheckboxList Control OnDataBinding Event Example with C#
ASP.Net CheckboxList Control OnDataBinding Event Example with C#

STEP 2 – write below code on Button Click Event and OnDataBinding Event of ASP.Net code page:

   protected void CheckBoxList1_DataBinding(object sender, EventArgs e)
{
Label1.Text = “Week Days”;
Label1.ForeColor = System.Drawing.Color.Red;
Label1.Font.Size = FontUnit.Large;
}

The ASP.Net CheckboxList Control OnDataBinding Event Example output is :

ASP.Net CheckboxList Control OnDataBinding Event Example with C#
ASP.Net CheckboxList Control OnDataBinding Event Example with C#

I hope this ASP.Net tutorials of Checkboxlist control OnDataBinding Event will help you….

Leave a Reply

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