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
Dr.Ajay Kashyap
NA
521
284.9k
Asp.net MVC model through validation of html page
Jun 2 2016 6:38 AM
I have a question on MVC ?
I created Model and also create html page using HTML tag Now I want to validate that page using That Model ...?
so how to validate html page (simple html tag )using model in mvc ?
Model:-
public partial class contactu
{
public int Id { get; set; }
[Required(ErrorMessage = "please provide First Name", AllowEmptyStrings = false)]
[AllowHtml]
public string Name { get; set; }
public string Address { get; set; }
[DataType(DataType.EmailAddress)]
[Required(ErrorMessage = "Please enter correct email address")]
public string Email { get; set; }
public string PhoneNo { get; set; }
public string Subject { get; set; }
public string Msg { get; set; }
}
Html Page :-
<form method="post" class="form-style-9" action="@Url.Action("contactus", "AdminUserLogin")">
<ul>
<li>
@*<input type="text" name="Name" class="field-style field-split align-left" placeholder="Name", id="Name" />*@
<input type="email" name="Email" class="field-style field-split align-right" placeholder="Email" id="Email" />
</li>
<li>
<input type="text" name="Phone" class="field-style field-split align-left" placeholder="Phone" id="Phone"/>
<input type="text" name="Address" class="field-style field-split align-right" placeholder="Address" id="Address"/>
</li>
<li>
<input type="text" name="Subject" class="field-style field-full align-none" placeholder="Subject" id="Subject"/>
</li>
<li>
<textarea name="Message" class="field-style" placeholder="Message" id="Message"></textarea>
</li>
<li>
<input type="submit" value="Send Message" />
</li>
</ul>
</form>
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
Reply
Answers (
3
)
drop down list display
how to store gridview datas to sql database