3

I've made an ASP.NET web form that uses the standard ASP.NET validation. I'd like to make the error summary show up in a jQuery UI Modal Message as well as below the actual form.

Is it possible to execute the script if the validation finds an error?

nlinus
  • 641
  • 5
  • 12

4 Answers4

2

You could hijack or override the ASP.net page validation function. This removes the need for an extra CustomValidator.
Here's a description of how to accomplish this.

Keep the validation summary in a hidden div, like Mike suggested. Then in your overridden function, call the original function to do the actual validation and display that div as the modal window.

Community
  • 1
  • 1
GeReV
  • 3,195
  • 7
  • 32
  • 44
1

I used the idea in the link provided by GeReV and here is what I came up with, in case someone needs it: Check here.

Let me add a note: Don't vote-down this post in case if it has to be a comment. I don't see a option to add comment.

gbs
  • 7,196
  • 5
  • 43
  • 69
0

You could do this with a CustomValidator. Set the ClientValidationFunction property to be a javascript function that would execute your desired jQuery.

Just for reference, here's an in-depth look at how you can manipulate validators on the client side.

womp
  • 115,835
  • 26
  • 236
  • 269
  • I'd actually have to write the custom validation function in order to make this work. If I had to do that I'd just switch to something like jQuery Validation. ASP.NET validation is just easy and I was hoping to use those validators. – nlinus Jun 11 '10 at 22:03
0

You can put the validation messages in a hidden div so that they would fill the div on some errors. Then manually show the ui modal specifying the content would be the content of the div.