How to validate fields using jquery in asp.net mvc 3 razor?

It's much easier and cleaner, you can do as below.

Up vote 1 down vote favorite share g+ share fb share tw.

Here my code: @using (Html. BeginForm("Register", "User", FormMethod. Post, new { id = "RegisterForm" })) { @Html.

TextBoxFor(m => m. EmailAddress, new { size = "40", @onchange = "UserNameVal();", @tabindex = "1" }) } $("#RegisterForm"). Validate({ rules: { EmailAddress: { required: true } }, messages: { EmailAddress: { required: " Please enter the Email address" } } }); jquery mvc asp.

Net-mvc-3 razor link|improve this question edited Jul 21 '11 at 5:32 asked Jul 21 '11 at 5:25yogee717 88% accept rate.

It's much easier and cleaner, you can do as below: public class MyModel { Required(ErrorMessage = "Please enter the Email address") public string Email { get; set; } }.

Ya using annotation is the best for razor... – yogee Jul 21 '11 at 13:24 I am glade that this helped you. – Feras Kayyali Jul 21 '11 at 13:29 I tried using jquery..but it didn't work out... I always prefer jquery for validation... – yogee Jul 21 '11 at 13:32.

If ($("#RegisterForm").valid()) { $("#RegisterForm").submit(); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions