TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ashwanikumar singh
NA
39
48.2k
Asp.net MVC Date validation
Dec 5 2017 12:39 PM
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
Answers (
2
)
chat service on my software
how to fix foreachllop iframe