Saturday, March 24, 2012

UpdatePanel and ASP.NET validation controls

Ok, here's the setup:

-- July version of ATLAS

-- Inside an update panel, we have an asp textbox and a required field validator.

-- Outside the update panel we have an image button.

If you click the image button without entering anything in the text box, you get the client-side validation (which is correct). Then, enter valid data and click on the image button with the mouse (don't tab off the text box first). The validator message is cleared, but the the button's click event is never fired. We always have to click it a second time.

We only have this problem in an update panel. Our workaround is to put client-script on the OnMouseDown event of the button to fire the click event. Does anyone know what may be causing this?

Thanks, --David

Turns out it's not an ATLAS problem at all. The validation controls are set to display="dynamic" and they were pushing the image button down (and pulling it back up) and the onmouseup event wasn't completing on the button. Who knew.

No comments:

Post a Comment