How to ensure ModalPopupExtender only shows when validation is successful?
How do I setup the ModalPopupExtender
to not show when the validation on the page fails? I have a Re开发者_运维技巧quiredFieldValidator
on a textbox. On Submit, I would like to show the ModalPopupExtender
ONLY if validation is successful.
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
It should be fairly straightforward. In your Page_Load or PreRender code, try something like this:
if (Page.IsValid)
{
myModalExtender.Show();
}
精彩评论