nnksoft is correct.
If you need do some processing on the server in order to validate, you
can make your server side function a webmethod and call it from the
javascript function you assign to the customvalidator control. The
best of both worlds :)

On Nov 15, 9:02 pm, nnksoft <nnks...@gmail.com> wrote:
> Look at your code, you did validate at server side. If you want your custom
> validator to work before the form to be submitted to server, I mean at
> client side, you must implement a Javascript function and set
> *ClientValidationFunction
> *attribute of CustomValidator control to function name.
>
>
>
> On Tue, Nov 16, 2010 at 12:49 AM, Justin <justin.lot...@gmail.com> wrote:
> > BUMP
>
> > On Nov 10, 2:10 pm, Justin <justin.lot...@gmail.com> wrote:
> > > I have very limited exposure to .NET.  So first, I'm working with
> > > VB.NET 3.5.
>
> > > I've been tasked with digitizing some forms for my job.  My custom
> > > validator is set to a TextField.  The function that does the actual
> > > validation (ValidatePercentEffort) checks a bunch of fields at once,
> > > verifying that the total sum of the fields is equal to some number.
>
> > > The problem is the CustomValidator is not being called before the
> > > ButtonClick event.  I have other validation controls on the page that
> > > do validate before the click event.
>
> > > So if I open up the page and immediatly submit, validation of all
> > > fields will should.  However, I only see the validation results of the
> > > non-CustomValidator fields.  Then, I fix all those errors, submit
> > > again.  This causes the button event to fire, THEN the custom
> > > validator runs.  So currently, I have the button's click function also
> > > validate teh form.
>
> > > Does anyone know why the customvalidator is not firing until after the
> > > buttonclick event is fired?  I've posted some snippets of my code,
> > > hopefully there is something useful in there, if not, I have no idea
> > > where to look.
>
> > > Thanks for any help.
>
> > > <asp:CustomValidator ID="CustomValidator1" runat="server"
> > >                     ErrorMessage="Blah blah bob loblah law blog"
> > >                     ControlToValidate="PercentEffort" ForeColor="Red"
> > > ValidationGroup="Val1"
> > >                     ValidateEmptyText="True" >*</asp:CustomValidator>
>
> > > <asp:Button ID="Save2" runat="server" Text="Save"
> > > ValidationGroup="Val1" />
>
> > > Protected Sub CustomValidator1_ServerValidate(ByVal source As Object,
> > > ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
> > > Handles CustomValidator1.ServerValidate
> > >         args.IsValid = ValidatePercentEffort()
> > >     End Sub- Hide quoted text -
>
> - Show quoted text -

Reply via email to