Click here to Skip to main content
15,075,394 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm using the dd/MM/yyyy format for the date entry and i need to Validate date month year with / separator i want to do that with compare validator..plz help me

If you just need to validate the format of the date then use a Regular Expression.

If you need to validate against a specific date then using a custom validator would be better since the date entered could be in different format, such as one or two digit month.
Refer this link

It has the excat solution you are asking for..

The converted code from vb to c#

Protected Page_Load(object sender, System.EventArgs e) 
        cmpStartDate.ValueToCompare =    System.DateTime.Now.ToShortDateString();
Protected btnValidate_Click(object sender, System.EventArgs e) 
        if (!Page.IsValid)
            Response.Write("Valid dates entered");
[no name] 24-May-12 9:53am
i want this in vc#
Jim Jos 24-May-12 10:08am
I have given a C# translation1!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900