Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 27, 2012 01:16 AM by Ict-Guy
Mar 25, 2012 01:07 PM|LINK
how to show alertbox in Razor mvc3. for validations
Mar 26, 2012 01:17 AM|LINK
asp.net mvc3 comes with jquery validate pluggin. You can customize that to show the error message in an alert instead of showing it in a page.
But think twice, do we need do this ? What if we have validations for 5 fields and user did not fill that tried to submit the form. Its gonna show 5 alerts to the user and that is not a good user experience. You can even customize the script to show the
first alert and return false there. But showing all error messages at once make the life of user easy. Thats y the validation summary messages there . How will you handle this if you use alert box ?
Mar 26, 2012 05:01 PM|LINK
Agree with the above point... ValidationSummary is ideal for showing errors. rather than showing them in alert boxes.
But, yes there are certain situations where alert box can also be handy. (A scenario when a user forgets to accept License terms)
To show alert box in MVC, you should use JQuery which is by default included as you create a new MVC application.
simply, call "alert" in your client-side method in JQuery
Mar 27, 2012 12:47 AM|LINK
var dialog = confirm('PHP is best.');
Mar 27, 2012 01:16 AM|LINK
Have a look at this blog