views:

296

answers:

2

How do I setup the ModalPopupExtender to not show when the validation on the page fails? I have a RequiredFieldValidator on a textbox. On Submit, I would like to show the ModalPopupExtender ONLY if validation is successful.

A: 

It should be fairly straightforward. In your Page_Load or PreRender code, try something like this:

if (Page.IsValid)
{
   myModalExtender.Show();
}
womp
The ModalPopupExtender by default shows on the client side when the control specified by the TargetControlId is clicked
DotnetDude
A: 

I set it up so that I can control it on the server side. This way, I was able to run the validation first before showing/hiding the ModalPopupExtender

DotnetDude