Re: Custom validation
From: simon (simon.zupan_at_stud-moderna.si)
Date: 05/28/04
- Next message: EricJ: "Re: terminal server client"
- Previous message: Selen: "Exception of type System.Exception was thrown"
- Maybe in reply to: Morten: "Custom validation"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 May 2004 09:19:47 +0200
Hi,
If I get rid of the ControlToValidate property then validation function is
executed but when I set
args.isValid=false, nothing happened.
It just pass by like if I set args.isValid=true.
No difference.
Any idea?
Thank you,
Simon
"DujHoD" <J242110559@aol.com> wrote in message
news:766f7500.0405270920.381e2705@posting.google.com...
> Try getting rid of the ControlToValidate property. It's not necessary
> for a CustomValidator, and in this case, it may be what is preventing
> the ServerValidate event from firing.
>
> For client-side validation, use the ClientValidationFunction property
> of the CustomValidator.
>
>
> "simon" <simon.zupan@stud-moderna.si> wrote in message
news:<#9sV2A8QEHA.1392@TK2MSFTNGP09.phx.gbl>...
> > I have 2 <asp:textbox controls>:
> >
> > <asp:textbox id="txt1" Runat="server" ></asp:textbox>
> >
> > <asp:textbox id="txt2" Runat="server" ></asp:textbox>
> >
> > User must insert the value either in txt1 OR in txt2, so one of them
> > shouldn't be empty.
> >
> > So I use custom validator:
> >
> > <asp:CustomValidator id="valPhone" Runat="server" ErrorMessage="You
must
> > insert text1 or text2!"
> > ControlToValidate="txt2"
> > Display="Dynamic"></asp:CustomValidator>
> >
> > AND server:
> >
> > Private Sub valPhone_ServerValidate(ByVal source As Object, ByVal args
As
> > System.Web.UI.WebControls.ServerValidateEventArgs) Handles
> > valPhone.ServerValidate
> > If txt1.Text = "" And txt2.Text = "" Then
> > args.IsValid = False
> > Else
> > args.IsValid = True
> > End If
> > End Sub
> >
> > The server validation is fired only if there is some value in txt2
box.If
> > txt2.text is empty then server validation is not fired.
> > How can I solve this problem?
> >
> > I would like also to include client validation.
> >
> > Thank you,
> > Simon
- Next message: EricJ: "Re: terminal server client"
- Previous message: Selen: "Exception of type System.Exception was thrown"
- Maybe in reply to: Morten: "Custom validation"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|