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
Abhilash J A
537
2.4k
596k
Require validation show when page load first mvc 5
Feb 27 2017 9:02 AM
Hello everyone,
I am working on MVC5,
1) How can I show required validation when page is first loaded as here csharp corner showing like that?
2) How can move error
*
massage to textbox right side as below image shown?
I have tried,
CSS.
/* styles for validation helpers */
.field-validation-error {
color
:
red
;
font-size
:
15px
;
}
.field-validation-valid {
display
:
none
;
}
input.input-validation-error {
border
:
1px
solid
red
;
}
select.input-validation-error {
border
:
1px
solid
red
;
}
input[type=
"checkbox"
].input-validation-error {
border
:
0
none
;
}
.validation-summary-errors {
color
:
red
;
}
.validation-summary-valid {
display
:
none
;
}
/*End*/
Model data annotation validation.
[Required]
public
string
LoginName {
get
;
set
; }
And this View,
@using (Html.BeginForm("GetPremiumUserReg", "UserRegister", FormMethod.Post, new {
id
=
"frmSubmitPremUserRegFirst"
}))
{
<
form
role
=
"form"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 col-sm-12 col-md-12"
>
<
div
class
=
"form-group"
>
@Html.ValidationMessageFor(
m
=
>
m.listPartnerVM.LoginName, "*")
@Html.TextBoxFor(
model
=
>
model.listPartnerVM.LoginName, new { @
id
=
"email"
, @
class
=
"form-control input-sm"
, @
placeholder
=
"Email Address"
})
</
div
>
</
div
>
</
div
>
<input type="submit" value="Submit" class="btn reg-btn btn-block">
</
form
>
}
Please help me...
Reply
Answers (
2
)
Error: server does not support secure connections.
How to prevent values from getting overwritten in session?