Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
Asp.net MVC Date validation
Ashwanikumar singh
Dec 5 2017 12:39 PM
198
I like to cover all validations on my form but when it comes to
date field
i always struggle.
And here i am again.
I have 2 Date field :
1.
Date of Birth
2.
Date of anniversary
The validations i want is
:
1) Date of birth must be 10 years back only from current date (i am not checking age for 18 years,i just want in my DOB field 10 years back date must be selected ).
2)And the anniversary date must be greater than Date of birth
3)since both are date field , in my textbox its accepting digits like : 12345656 .
It musts accept only date.
here is my model class :
namespace test.Models
{
public class Student
{
[Required(ErrorMessage ="Date of birth is required")]
[DataType(DataType.Date)]
public string DOB { get; set; }
[Required(ErrorMessage = "Date of anniversary is required")]
[DataType(DataType.Date)]
public string DOA { get; set; }
}
}
I am asking for big but its not allowing me to sleep.
If anybody can help. Thanks in advance !!!!
Reply
Upload Source Code
Select only zip and rar file.
Post
Reset
Answers (
2
)
how to get particular data of iframe
how to fix foreachllop iframe