Page view counter

PopupControlExtender onmouseover flickers

Last post 10-06-2008 6:04 AM by Vince Xu - MSFT. 5 replies.

Sort Posts:

  • PopupControlExtender onmouseover flickers

    10-02-2008, 11:44 AM
    • Loading...
    • rchris007
    • Joined on 02-19-2008, 2:45 PM
    • Posts 5
    • Points 0

    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.

     

    Bob
  • Re: PopupControlExtender onmouseover flickers

    10-02-2008, 12:06 PM
    • Loading...
    • vgiambattista
    • Joined on 01-13-2006, 2:40 PM
    • Atlanta, GA
    • Posts 1,283
    • Points 8,380

    rchris,

    Instead of trying to chain events like this, you can call the _showPopup and _hidePopup from clientscript instead.  You'll want to set your TargetControlID to a HiddenField control.  Then you can call $find('PME1') to get a reference to your extender, and call its _showPopup() method to display the popup.

    I tried to do a sample for you, but your code fragment has too much going on beyond what you've posted.  I hope this is enough to get you started.

    James

    James Ashley, Magenic Technologies
    (james.ashley.magenic@gmail.com)
  • Re: PopupControlExtender onmouseover flickers

    10-02-2008, 2:21 PM
    • Loading...
    • rchris007
    • Joined on 02-19-2008, 2:45 PM
    • Posts 5
    • Points 0

    Thanks.  That worked, sort of.  The mouseover now shows and hides the popup nicely, but it is not positioned with reference to the image.  Rather, the popup is displayed in the upper left corner of the page.  Changing the TargetControlID changed the position of the popup. 

    Do I need a hidden field near each image? Or is there another way to position the popup near the image?

    Here's the code now:

     

     

    function showSwatch(id) {

    var myPME = $find(id);

    if(myPME){

    myPME.showPopup();

    }

    }

    function hideSwatch(id) {

    var myPME = $find(id);

    if(myPME){

    myPME.hidePopup();

    }

    }

     

    Codebehind:

    Dim PME1 As New AjaxControlToolkit.PopupControlExtender

    PME1.PopupControlID = "ctl00_ContentPlaceHolder1_popupdivdiv" & j

    PME1.TargetControlID = "popSelector"  'this is a single hidden field used by all images

    PME1.Position = AjaxControlToolkit.PopupControlPopupPosition.Top

    PME1.ID =
    "PME_" & j

    PME1.BehaviorID = "PME_" & j

    PlaceHolder1.Controls.Add(PME1)

     

    Thanks.

    Bob
  • Re: PopupControlExtender onmouseover flickers

    10-02-2008, 2:29 PM
    • Loading...
    • rchris007
    • Joined on 02-19-2008, 2:45 PM
    • Posts 5
    • Points 0

    Actually the solution was much simpler than that... I just set the TargetControlID back to the ImageButton and wa-la, all is good Yes

    Bob
  • Re: PopupControlExtender onmouseover flickers

    10-02-2008, 2:39 PM
    • Loading...
    • rchris007
    • Joined on 02-19-2008, 2:45 PM
    • Posts 5
    • Points 0

    Unfortunately, the flicker remains.  Mouseover the popup and it flickers.

    Bob
  • Re: PopupControlExtender onmouseover flickers

    10-06-2008, 6:04 AM
    Answer

    Hi,

    Can you use ModalPopup instead? Please check this thread: http://forums.asp.net/t/1316201.aspx

    The modalpopup window can display the detail about the related row of GridView by mouse over and mouse out.

     


    Vince Xu
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (6 items)