Tuesday, January 29, 2008 3:34 PM kevinisom

Hiding a Popup Panel with JavaScript

Had a instance where I needed to close the Popup Control with JavaScript

   1:  <ajax:PopupControlExtender ID="pceShowPanel" runat="server"
   2:      TargetControlID="showPanel"
   3:      PopupControlID="popupPanel" 
   4:      BehaviorID="popupBehavior"                 
   5:      />

So with that on your page just hide it with hidePopup().

   1:  function Hide(){
   2:      $find('popupBehavior').hidePopup()
   3:  }

Of course you can show the popup as well with the showPopup() method. The real trick here is the $find shortcut method. The FindComponent method does just that and get's the component in this case the PopupExtender and allows you to call the methods associated with that control.

Filed under: , , ,

Comments

# re: Hiding a Popup Panel with JavaScript

Tuesday, April 08, 2008 11:13 PM by Mark Luhring

Kevin,

I am trying to find a way to toggle a panel open and closed using the PopupControlExtender.  I am not having any luck.  If I set the TargetControlId to a hidden control and try to use showPopup() and hidePopup() in a javascript function called by clicking on an imageButton nothing happens.

Do you have any insight into this.  I think I could make this work with the ModalPopupExtender, except I don't want the popup panel to be modal.

Mark

mluhring@yahoo.com

# re: Hiding a Popup Panel with JavaScript

Thursday, August 26, 2010 2:04 PM by Brandon

I'm trying to issue the $find('popupBehavior'); command in the Google Chrome console, and it can't find anything.

I've also tried to issue similar commands from other posts, but the objects just can't be found.

Any ideas?

Leave a Comment

(required) 
(required) 
(optional)
(required)