Kevin Isom

Just a good ol' boy, by-God Virginia-proud and country-sophisticated -- sort of like a John Deere tractor with air conditioning and satellite radio.

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.

Published Tuesday, January 29, 2008 3:34 PM by kevinisom

Comments

# re: Hiding a Popup Panel with JavaScript@ Tuesday, April 08, 2008 11:13 PM

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

by Mark Luhring

Leave a Comment

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