ValidationMessageFor shows a specific error next to that field in a form. So next ot the Title textbox you would see a validation appear specific to title.
ValidationSummary provides a summary at the top of the page where you see all the errors (title, etc).
But i took it out from the code and still everthing worked fine.
Taking out the code doesn't hurt anything, it just removes that capability so if there is a bunch of errors you won't see a summary at the top with all errors. Sometimes this is desirable depending on your site design.
anderson7777
Member
141 Points
279 Posts
What is that @Html.ValidationSummary(true)
Jan 24, 2013 01:04 AM|LINK
I was studying a tutorial and I saw this.
I took it ou and nothing happened.
What is the function of @Html.ValidationSummary(true) ?
I already have in my code something like @Html.ValidationMessageFor(model => model.Title)
thx
Anderson
BrockAllen
All-Star
27434 Points
4891 Posts
MVP
Re: What is that @Html.ValidationSummary(true)
Jan 24, 2013 01:12 AM|LINK
The summary shows all the verbose messages as to what went wrong with validation.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
anderson7777
Member
141 Points
279 Posts
Re: What is that @Html.ValidationSummary(true)
Jan 24, 2013 01:14 AM|LINK
But i took it out from the code and still everthing worked fine.
CodeHobo
All-Star
18647 Points
2647 Posts
Re: What is that @Html.ValidationSummary(true)
Jan 24, 2013 01:14 AM|LINK
ValidationMessageFor shows a specific error next to that field in a form. So next ot the Title textbox you would see a validation appear specific to title.
ValidationSummary provides a summary at the top of the page where you see all the errors (title, etc).
Blog | Twitter : @Hattan
CodeHobo
All-Star
18647 Points
2647 Posts
Re: What is that @Html.ValidationSummary(true)
Jan 24, 2013 01:15 AM|LINK
Taking out the code doesn't hurt anything, it just removes that capability so if there is a bunch of errors you won't see a summary at the top with all errors. Sometimes this is desirable depending on your site design.
Blog | Twitter : @Hattan