asp.net, c# I have only one checkbox, and I want to keep NULL to the SQL server
ID: 3794313 • Letter: A
Question
asp.net, c#
I have only one checkbox, and I want to keep NULL to the SQL server until the user checks the checkbox then change a Null to the 1, which is check, and 0 which is unchecked.
how can I do that?
this is my code from asp.net
<td valign="top"><br />
<asp:Panel ID="rblMandatoryAppearanceBox" runat="server" Height="24.5px" BorderWidth="1" BorderColor="#7F9DB9" BorderStyle="Solid">
<asp:CheckBox ID="lblMandatoryAppearance" runat="server" Text="MandatoryAppearance" />
</asp:Panel>
</td>
and c# code:
if (lblMandatoryAppearance.Checked.Equals(-1))
{
lgl_eve.MandatoryAppearance.Equals(0);
}
else
{
lgl_eve.MandatoryAppearance = Convert.ToBoolean(lblMandatoryAppearance.Checked);
}
I have column in SQL and I want if the user open the web.aspx so many times and do not click on the checkbox, keep it as NULL in the SQL, and any time user open the web.aspx and click on the checkbox, change the value in SQL to 1 which means selected and if user unchecked the checkbox make it to 0 in SQL which is unchecked
in fact, I want to be null as long as a user do not click on the checkbox.
how can I do that, please help.