Results 1 to 2 of 2

Thread: costum validator problem

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    32

    costum validator problem

    It's my first time i want to write a cotum validator but it doesn't seem to
    work. In de page i've put this validator:
    <asp:CustomValidator id="CVFBeginDate"
    OnServerValidate="CVFBeginDate_ServerValidate" runat="server"
    ErrorMessage="Please fill in a valid date as startdate"
    ControlToValidate="TxtBeginDate">*</asp:CustomValidator>

    in de codebehindpage i have created this sub:
    Protected Sub CVFBeginDate_ServerValidate(ByVal source As System.Object,
    ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles
    CVFBeginDate.ServerValidate
    Try
    tmp = args.Value.Split("/")
    testDate = New Date(tmp(2).ToString(), tmp(1).ToString(),
    tmp(0).ToString())
    args.IsValid = True
    Catch
    args.IsValid = False
    End Try
    End Sub


    it doesn't seem to work. do you have to put something special to the custom
    validator?

  2. #2

    Thread Starter
    Member
    Join Date
    Mar 2005
    Posts
    32

    Re: costum validator problem

    solved. had to use page.isvalid to trigger validation

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width