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

Reply via email to