AutoCompleteExtender - Aligning Popup position

Last post 07-08-2009 1:33 AM by faruz. 3 replies.

Sort Posts:

  • AutoCompleteExtender - Aligning Popup position

    07-05-2009, 4:42 AM
    • Member
      point Member
    • faruz
    • Member since 07-05-2009, 4:36 AM
    • Posts 3

    Hi,

    I'm working with the AutoCompleteExtender and have a problem aligning the results-popup with the textbox.

    I've written a JS function that executes onClientShown of the extender, and it runs perfectly on first execution.

    After I press any key (even alt+shift), the popup "jumps" about a 100 pixels to the left, where it stays until I press ESC and then it starts over.


    Should I put my JS function somewhere else?

    I'm using $common.SetLocation in my JS.


    Love movies? Visit www.moviez.4pu.com
  • Re: AutoCompleteExtender - Aligning Popup position

    07-07-2009, 1:33 AM

     Hi,

    You can use this client event, and add_populated event maybe another choice. Did your code in onClientShown impacts on the position of pop-out list? Or you can define keypress event of textbox to reset the location of pop-out list.


    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.
  • Re: AutoCompleteExtender - Aligning Popup position

    07-08-2009, 12:24 AM
    • Member
      point Member
    • faruz
    • Member since 07-05-2009, 4:36 AM
    • Posts 3

    Yes, the event I wrote fixes the position.

    Only problem is after a key was pressed that it loses position.

    I'll try to put the event in the textbox.keypress.

    Love movies? Visit www.moviez.4pu.com
  • Re: AutoCompleteExtender - Aligning Popup position

    07-08-2009, 1:33 AM
    • Member
      point Member
    • faruz
    • Member since 07-05-2009, 4:36 AM
    • Posts 3

    OK. That didn't help.

    I alerted the values of the _CompletionList position and the browser claims that the CompletionList never moved...

    I attach here my JS segment to move the completionList position. (It also changes the width to be minimum the size of the textbox):


    function ResizeWidthAndPosition(sender,e)
    {
      if (sender._completionListElement.offsetWidth<sender.get_element().offsetWidth)
      {
        sender._completionListElement.style.width = sender.get_element().offsetWidth+'px';
        var tb = sender._element;
        var tbPos = [tb.offsetLeft + tb.offsetParent.offsetLeft, tb.offsetTop + tb.offsetParent.offsetTop];
        var xPos = tbPos[0]+9;
        var yPos = tbPos[1]+121;
        $common.setLocation(sender._completionListElement,new Sys.UI.Point(xPos,yPos));
      }
      else
        sender._completionListElement.style.width = 'auto';
    }


    Love movies? Visit www.moviez.4pu.com
Page 1 of 1 (4 items)