this is my fist question, I have been searching about how to use checkbox in a c# web form, and I found some codes that almost is what I need, but I keep getting an error because all those codes does not apply for C# web forms specifically.
File.aspx has this code:
<asp:CheckBox ID="cbxScheduleDate" runat="server" Text="Schedule for today" AutoPostBack="true"; OnCheckedChanged="cbxScheduleDate_CheckedChanged"/>
File.aspx.cs has this code:
protected void cbxScheduleDate_CheckedChanged(object sender, EventArgs e)
{
if (cbxScheduleDate.Checked)
txtScheduleDate.Visible = false;
else
txtScheduleDate.Visible = true;
}
So, what I need is when the checkbox is checked I make the txtScheduleDate textbox not visible.
Right now with that code, Visual Studio has the error:
The name 'cbxScheduleDate' does not exist in the current context
Does anyone now how to solve this Visual Studio error, or another way to make this work?
Thank you!