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
Maharudra Gadekar
1.1k
367
81.9k
How to show validation Error Message in MVC view?
Nov 16 2016 4:01 AM
Hello,
I am design the view using table tag and put all controls with validationmessagefor(i.e @Html.ValidationMessageFor(model => model.firstname ) and also define in my model that properties show add required dataanotation are as follws:
[Display(Name = "First Name(????? ???):")]
[Required(ErrorMessage = "Enter First Name")]
public string firstname { get; set; }
and also check in my controller [HttpPost ]
actionresult method
if(Modelstate.Isvalid)
{
my save data logic
}
else
{
return view();
}
then if i am not enter the field textbox value and click on button then does not the validation error message........
but i am using scafolding feature using create view then add field in div tag then show error message......
How to resolved my problam...plz help me.
Thanks in advance
Reply
Answers (
2
)
help me in ccoding
how to use WebSecurity.InitializeDatabaseConnection