Responsive Ads Here

Saturday, May 4, 2013

Display Validation summary in a popup using jquery modal popup

The Validation Summary control enables you to display a list of all the validation errors in a page in one location. This control is particularly useful when working with large forms. If a user enters the wrong value for a form field located toward the end of the page, then the user might never see the error message. If you use the Validation Summary control, however, you can always display a list of errors at the top or bottom of the form or we can show in a popup. The below lines will be useful to display the validation summary in simple popup.

 

Using the above code all the validation summary will be displayed in a pop up, it will be looks like a java script popup. some times client will not accept this type of pop ups they want rich look for pop ups. We can achieve this using jquery modal popup by using the below code. Directly it is not possible to display jQuery Modal Dialog popup when ASP.Net Validation fails, hence we need to override the WebForm_OnSubmitmethod. You need to follow the below steps. 

1. Add a HTML DIV control validation_dialog for jQuery Modal Dialog popup and place the ASP.Net Validation Summary control inside it.
 2. For all the ASP.Net Validations set Display property to None. 
3. Finally place the following script in start of your form Tag or Content Placeholder and done! The complete page HTML markup is given below

  
   
   Untitled Page  
     
     
     
   
   
   
Name:
Email:

To find the complete explanation and demo please click here  

No comments:

Post a Comment