Hiding Modal popup extender from client side
I need to hide the modal popup on client using javascript.
if I use
$find('ModalPopupExtender1').hide();
for hiding it is throwing an error saying
开发者_运维问答'null' is null or not an object'
There are two options to solve this:
Change ID of the modalpopup to
ModalPopupExtender1
Change your script to this:
$find('<%= ModalPopupExtender1.ClientID%>').hide();
There are two options to solve this:
Change/add a behaviorID to the modalpopup and name it
ModalPopupExtender1
Change your script to this:
$find('ModalPopupExtender1').hide();
It sounds like the $find call is probably not finding the behavior. Can you change the code to:
var behavior = $find('ModalPopupExtender1');
var undefined;
if (behavior !== undefined)
alert("found");
else
alert("not found");
There are two options to solve this:
Change/add a behaviorID to the modalpopup and name it ModalPopupExtender1
Change your script to this: $find('ModalPopupExtender1').hide();
I was having no luck with any of the above techniques, nor any others I found on the Web. Something that DOES work for me is to call
__doPostBack("xxx", 0);
This causes a proper page reload and the popup does NOT come back. Note that my code-behind does not explicitly look for or handle the "xxx" param, it just lets the postback reload the page.
I'll concede that the OP was probably looking to close the popup w/o refreshing the page, but in my case I DID want the refresh, so this works for me.
精彩评论