5
Reply

How to check box value dynamically using findcontrol c# asp.

Venkat Govind

Venkat Govind

Aug 18 2017 12:48 AM
209
Hi All,good Morning,
 
below is my html code 
.
<table>
<tr>
<td><asp:CheckBox ID="CheckBox1" runat="server" /></td>
<td><asp:CheckBox ID="CheckBox2" runat="server" /></td>
<td><asp:CheckBox ID="CheckBox3" runat="server" /></td>
<td><asp:CheckBox ID="CheckBox4" runat="server" /></td>
<td><asp:CheckBox ID="CheckBox5" runat="server" /></td>
</tr>
</table>
 
Below code i am trting to get checkbox checked status dynamically but i am getting object refernce not in set Pls provide related code
 
for (int i = 0; i <= 4; i++)
{
CheckBox chk = (CheckBox)this.FindControl("CheckBox"+i);
if (chk.Checked)
{
}
else
{
}
}
 Thanks 
VeKaT G 
 

Answers (5)