Click here to Skip to main content
15,846,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Can anyone provide me with an example that how can I write validations using JQuery in asp.net MVC3.

Thanks,
Posted

say for required field for Username textbox.





function validate()
{
var txtValue = $('#txtUsername').val();

if (txtValue == '' || txtValue == null || txtValue == undefined)
{
alert ('Username is required.');
$('#dvUsernameMessage').html('Username is required.');
}
}
 
Share this answer
 
hello
on mvc we can not used server control for form validation we can used jquery function that it very light and easy understand.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900