Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I validate 1st 6 numbers of an ID Number with a Date of Birth?
Posted
Updated 4-Nov-11 3:57am
v2
Comments
Yvan Rodrigues 4-Nov-11 9:58am    
Can you elaborate more?
Windows Forms, Web Forms, or WPF?
arya1685 4-Nov-11 10:27am    
Can u provide more details or past your aspx code

C#
DateTime dob = DateTime.Now;
string dobStr = dob.ToString("MMddyy");
if (idNumber.StartsWith(dobStr))
{
    // we have a match - do something
}


You'll have to change the ToString parameter if your ID numbers use the month/day/year in a different order.

In order to validate this, you'll need a custom validator (on a web form).
 
Share this answer
 
v2
If i am not wrong then you want server side validation OnClick event of button and it's validate then redirect to second page otherwise show an validation message.

If i m right then.....


OnClick event of button execute select statement with ID and data field entered by user and if any row fount the redirect to next page or whatever you want otherwise show validation message in label.............
 
Share this answer
 

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



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