Validating Check Boxes
-
I'm having a problem which I thought would be a very simple thing but is > > turning out to be a difficult challenge. I have a web form with several input > > fields and I have a single checkbox, not a checkbox list. Before the form can > > be submitted I want to require that the checkbox be checked. Sounds simple > > but non of the validation controls seem to work correct for this, or maybe > > I'm just not using them correctly. I have done several searches but I can't > > seem to find any examples of this type of thing being done. Which is very > > surprising because this sort of checkbox is a very common thing. i.e. "I > > agree to the terms....." Can anyone point me to an example? I'm using ASP.NET > > 2.0 Thanks
seema
-
I'm having a problem which I thought would be a very simple thing but is > > turning out to be a difficult challenge. I have a web form with several input > > fields and I have a single checkbox, not a checkbox list. Before the form can > > be submitted I want to require that the checkbox be checked. Sounds simple > > but non of the validation controls seem to work correct for this, or maybe > > I'm just not using them correctly. I have done several searches but I can't > > seem to find any examples of this type of thing being done. Which is very > > surprising because this sort of checkbox is a very common thing. i.e. "I > > agree to the terms....." Can anyone point me to an example? I'm using ASP.NET > > 2.0 Thanks
seema
Seema, No one can help you unless see your code....So please post your code!! In the meantime you can look into... <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> Untitled Page
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click If Me.ChkName.Checked = True Then Response.Write("Selected") Else Response.Write("Not Selected") End If End Sub Thanks!! -- modified at 15:06 Wednesday 19th September, 2007 Amit Gugnani