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
Guest User
Tech Writer
2.1k
472.8k
Better way to handle error on web app?
Jul 22 2020 10:42 AM
HI Team
I have created some logic around handling error, but im not getting any error. The idea when a user leave @EditorFor must validate the message with image error. I have done this following, but its not working debug nothing, maybe missing something pls assist.
// Model
[Required(ErrorMessage =
" This field is required"
)]
[EmailAddress(ErrorMessage =
"Invalid email address"
)]
public
string
Email {
get
;
set
; }
// View on Form
<div
class
=
"form-group row"
>
<label
for
=
"Email"
class
=
"col-sm-2 col-form-label"
>Email:</label>
<div
class
=
"col-sm-4"
>
@Html.EditorFor(model => model.RegForm.Email,
new
{ htmlAttributes =
new
{ @
class
=
"form-control"
, autofocus =
"autofocus"
, placeholder =
"Email"
} })
@Html.ValidationMessageFor(model => model.RegForm.Email,
""
,
new
{ @
class
=
"text-danger"
})
</div>
</div>
// Javascript
<!---JavaScript error handling-->
<script type=
"text/javascript"
src=
"~/Content/dist/js/jquery.validate.min.js"
>
</script>
<script type=
"text/javascript"
src=
"~/Content/dist/js/jquery.validate.unobtrusive.min.js"
>
</script>
Reply
Answers (
2
)
SqlException or binary data be truncated?
Not able to publish from visual studio 2013 .