Wednesday, March 28, 2012

Accessing PopupControl methods from client script

Hi,

How can I access the client-side functions of the PopupControl (namely "hide()")? Rather than the user having to click elsewhere on the page I also want to have a close button. According to the Firebug DOM explorer, the div element thats used for the popup has a property "PopupBehaviour" but trying to access this throws an error.

Cheers

Hi,

Not sure if this is the "correct" way to do this but I do this:

ButtonClose.Attributes.Add("OnClick","__AjaxControlToolkit_PopupControlBehavior_VisiblePopup.hidePopup();");

HTH

Jeff


I'm running into the same problem. I want to do a client-side close of the popupcontrol. I tried getting the uniqueid of the panel that's being popped up and setting the .style.display property to 'none' and that closes the panel but the problem is that whatever controls the panel used to cover are disabled. They've done this on purpose to disable controls from underneath the overlayed panel from being selected while you are selecting controls on the panel. So my solution half works.

Does anyone in the ASP team or someone who's had a need to close the popupcontrol control on the client-side have a clean a proper solution for this? Doing a postback to close the extender is a really stupid way of closing it so I'm sure someone must have come across this... Thanks!


Hi,

In version 1.0.10123.0 of the toolkit i do this on the client side which seems to work, as I said before I'm not sure if this is the correct way but it works.

AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup();
hth
Jeff 

I found this nice free popupcontrol. It comes with full source and also the .dll. Its nice to have this control in your Visual Studio Toolbox. ;)

Dainty Date


Jeff, thanks that works.


Cool. I will try that. Currently I use a button that calls "document.body.click()" to simulate the clicking elsewhere outside of the popup which effectively closes it.

Hi,

The easeist way to do this is add a BehaviorID="MyPopup" on the extender and then usevar behavior = $find('MyPopup'); in script.

Thanks,
Ted

No comments:

Post a Comment