CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2008
    Posts
    8

    problem in validation control

    i use a validation control for displaying data in correct format.If the user enters date in a text box he must enter it in mm/dd/yyyy format but if he enters wrongly it must dispaly an error message which i want to do it using validation control

    and i have written the code for it in the following format:

    <asp:regularexpressionvalidator id="regExpDate" runat="server" Display="Dynamic" EnableClientScript="False" ControlToValidate="txtSelect"
    ErrorMessage="It is not a valid date.Format is MMDDYY" ValidationExpression="^\d{2}[\/-]\d{2}[\/-]\d{2,4}$"></asp:regularexpressionvalidator></TD>


    but its not working

    can anyone sort it out

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: problem in validation control

    [ moved ]
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3

    Re: problem in validation control

    First, if you're requiring a 4 digit year, make the last part \d{4}, otherwise it will accept a 2, 3, or 4 digit year.

    Otherwise, what values are you testing with?

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

Featured