In asp.net Webforms I have a CheckBox and Button.
<asp:CheckBox ID="checkBox" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Check" OnClick="Button1_Click"/>
I want to handle Checkbox's check status with ButtonClick. But it is only getting false value.
if (checkBox.Checked == (true))
{
Label1.Text = "Selected";
}
else
{
Label1.Text = "Not Selected";
}
After every click I am getting Not Selected in my Label. I think this is so basic but now I couldn't fix.
Is there anyway to fix this.
if (checkBox.Checked == ...part (or at least its full name and declaration).