stumped again!
trying to do validation on a check box - real simple - i just need to be sure the checkbox for the policy agreement is checked before submit is ok.
-the best case scenario i have had is no error, but nothing - it allows submit
-i have tried putting the test for checked in several different places but got errors for any placement other than this one
form code:
<form id="form1" runat="server">
<asp:CheckBox ID="agree" runat="server" />
*By checking this box, I understand the policy stated above.
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:Button id="SubmitProgram" style="text-align: center" runat="server" Text="Submit" OnClick="SubmitProgram_Click"></asp:Button>
code behind:
public partial class program_add_Default : System.Web.UI.Page
{
void ServerValidation(object source, ServerValidateEventArgs args)
{
args.IsValid = (agree.Checked == true);
}
protected void SubmitProgram_Click(object sender,EventArgs e)
{
if (Page.IsValid == true)
{
//do some stuff..
}
}
}
trying to do validation on a check box - real simple - i just need to be sure the checkbox for the policy agreement is checked before submit is ok.
-the best case scenario i have had is no error, but nothing - it allows submit
-i have tried putting the test for checked in several different places but got errors for any placement other than this one
form code:
<form id="form1" runat="server">
<asp:CheckBox ID="agree" runat="server" />
*By checking this box, I understand the policy stated above.
<asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="CustomValidator"></asp:CustomValidator>
<asp:Button id="SubmitProgram" style="text-align: center" runat="server" Text="Submit" OnClick="SubmitProgram_Click"></asp:Button>
code behind:
public partial class program_add_Default : System.Web.UI.Page
{
void ServerValidation(object source, ServerValidateEventArgs args)
{
args.IsValid = (agree.Checked == true);
}
protected void SubmitProgram_Click(object sender,EventArgs e)
{
if (Page.IsValid == true)
{
//do some stuff..
}
}
}