I have a product gallery aspx page that displays product images from a database. I want a popup div to display onmouseover on each image, to allow the user to select options (imagebuttons in the popup).
For each image (imageButton) I am creating a div and a PopupControlExtender in codebehind like this:
Dim PME1 As New AjaxControlToolkit.PopupControlExtender
PME1.PopupControlID = "ctl00_ContentPlaceHolder1_popupdivdiv" & j 'This is the poup div to display
PME1.TargetControlID = "prodimg" & j 'This is the imagebutton ID
PME1.ID = "PME_" & j
PlaceHolder1.Controls.Add(PME1)
Because the PopupControLExtender fires when the TargetControl gets focus, I set focus on mouseover like this:
btn.Attributes.Add(
"onmouseover", "this.focus();")
That is fine and good, but the popup does not close on mouseout (except when mouseover another image). So I added this code to close the popup.
btn.Attributes.Add("onmouseout", "this.blur();if(AjaxControlToolkit.PopupControlBehavior.__VisiblePopup){AjaxControlToolkit.PopupControlBehavior.__VisiblePopup.hidePopup()}; return false;")
Now the popup div flickers when the mouse is over the popup.
Does anyone have a better suggestion for closing the popup (on mouseout that is - I don't want to require them to click to close it).
Thanks.