[AutoCompleteExtender] How to show the completion list popup manually?

Last post 11-07-2008 2:43 PM by jb_harris. 6 replies.

Sort Posts:

  • [AutoCompleteExtender] How to show the completion list popup manually?

    09-26-2007, 8:59 PM
    • Member
      2 point Member
    • fyts
    • Member since 09-27-2007, 12:55 AM
    • Posts 4

    When I clicked a button, I want to show AutoCompleteExtender's completion list popup.
    I try to use "showPopup()", but no response was returned.
    What shold I do to show the completion list popup manually?

    [example]

    <asp:Button ID="ButtonAutoCompleteViewList" runat="server" OnClientClick="onAutoCompleteViewList(); return false;" />
    
    function onAutoCompleteViewList()
    {
        var targetTextBox = $get("idTargetTextBox");
        var autoComplete = $find("idAutoComplete");
    
    	// I try showPopup(), but no response 
        // autoComplete.showPopup();
    
        // what shold I do?
    }
     
  • Re: [AutoCompleteExtender] How to show the completion list popup manually?

    09-28-2007, 5:25 AM
    Answer

    Hi Fyts,

    As far as I know , we can show the popped up div but as my test indicates that all content is cleared when the AutoCompleteExtender is hiding. 

    To show the the div, you should use this.

               function show(){

                     //get the object            $get($find("myACEBID")._completionListElementID).

                     alert($get($find("myACEBID")._completionListElementID).outerHTML)
                } 

    I hope this help.

    Best regards,

    Jonathan

    Jonathan Shen
    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] How to show the completion list popup manually?

    09-28-2007, 6:29 AM
    • Member
      2 point Member
    • fyts
    • Member since 09-27-2007, 12:55 AM
    • Posts 4

    Hi Jonathan,

    Thank you for the response.

    I tested your method.
    The _completionListElementID's outerHTML was filled by contents when the popup was showing.
    But it's content was cleared when the popup was hiding.

    I have two related questions.

    1. Does the AutoCompleteExtender has no method to show the popup by JavaScript?

    2. If 1 is true, what object can I use?
       Please tell me a start point to customize the AutoCompleteExtender.

    Thank you.

     

  • Re: [AutoCompleteExtender] How to show the completion list popup manually?

    09-28-2007, 7:37 AM
    Answer

    Hi Fyts,

    fyts:
    1. Does the AutoCompleteExtender has no method to show the popup by JavaScript?

    Based on my knowledge,  AutoCompleteExtender has no direct method to show the popup by Javascript.

    fyts:
    2. If 1 is true, what object can I use?
       Please tell me a start point to customize the AutoCompleteExtender.

    Please dip into its source code and pay special attention to _update() function which is located on line 700 inside AutoCompleteBehavior.js. Maybe you can create another div. When the AutoCompleteExtender is shown, you can get all the content and put them inside your own div. Now you can do whatever you want.

    Hope this help.

    Best regards,

    Jonathan

    Jonathan Shen
    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] How to show the completion list popup manually?

    09-30-2007, 12:03 AM
    • Member
      2 point Member
    • fyts
    • Member since 09-27-2007, 12:55 AM
    • Posts 4

    Hi Jonathan,

    Thank you for giving me many useful advices.
    I will try to show the popup by JavaScript.

    --
    fyts

  • Re: [AutoCompleteExtender] How to show the completion list popup manually?

    10-01-2007, 8:32 AM
    Answer
    • Member
      2 point Member
    • fyts
    • Member since 09-27-2007, 12:55 AM
    • Posts 4

    Hi Jonathan,

    I found the way to show the popup by JavaScript.
    This way do not need to customize the AutoCompleteExtender.

    Thank you for your help.
    Your hint were very useful to me.


    [FYI]
    The following is how to show the completion list popup by JavaScript.

     

    <asp:Button ID="ButtonAutoCompleteViewList" runat="server"
    OnClientClick="onAutoCompleteViewList(); return false;" />
     
    function onAutoCompleteViewList()
    {
        var autoComplete = $find("idAutoComplete");
    
        // To show the popup by JavaScript, following code is necessary.
        // [NOTE] This trick is weak if the AutoCompleteExtender is updated.
        autoComplete._cache = {};
        autoComplete._currentPrefix = null;
        autoComplete._textBoxHasFocus = true;
    
        // save the old minimum prefix length, and set the value 0
        var oldMinimumPrefixLength = autoComplete.get_minimumPrefixLength();
        autoComplete.set_minimumPrefixLength(0);
    
        // send the event to show the popup
        autoComplete._onTimerTick(null, null);
        
        // restore the old minimum prefix length
        autoComplete.set_minimumPrefixLength(oldMinimumPrefixLength);
    }
     Thank you.
  • Re: [AutoCompleteExtender] How to show the completion list popup manually?

    11-07-2008, 2:43 PM
    • Member
      10 point Member
    • jb_harris
    • Member since 11-07-2008, 2:41 PM
    • Posts 5

    I humbly recommend the change shown here.

    <script type="text/javascript">

    function onAutoCompleteViewList() {

    var autoComplete = $find("<%=ace1.ClientID%>");

    // To show the popup by JavaScript, following code is necessary.

    // [NOTE] This trick is weak if the AutoCompleteExtender is updated.

    autoComplete._cache = {};

    autoComplete._currentPrefix = null;

    autoComplete._textBoxHasFocus = true;

    // save the old minimum prefix length, and set the value 0

    var oldMinimumPrefixLength = autoComplete.get_minimumPrefixLength();

    autoComplete.set_minimumPrefixLength(0);

    // send the event to show the popup

    autoComplete._onTimerTick(null, null);

    // restore the old minimum prefix length

    autoComplete.set_minimumPrefixLength(oldMinimumPrefixLength);

    }

    </script>

     

    This will allow the functionality to successfully navigate masterpages and usercontrols.

    Brad

Page 1 of 1 (7 items)