Change ServiceMethods and Web Service for the AutoCompleteExtender From Client Side

Change ServiceMethods and Web Service for the AutoCompleteExtender From Client Side

  • Comments 8

This is quite a common requirement and guess the Docs are not really clear as to how you can achieve this .

Lemme see how I can help

  1. You want to  change the Webmethod that the AutoComplete Extender Talks to from the Client Side.
  2. You want to  change the WebService that the AutoComplete Extender Talks to from the Client Side.

You can achieve this easily using the Functions Provided by the Extenders on the Client Side.

Follow these Simple Steps.

1) Assign a BehaviourID to the AutoCompleteExtender.

 

<cc1:AutoCompleteExtender 
               ID="AutoCompleteImagesExtender1" runat="server" TargetControlID="myTextBox"
                ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="2"
                CompletionInterval="1000" EnableCaching="true" 
                CompletionListElementID="divCompletionImages"
                CompletionSetCount="12" 
                BehaviorID="autoCompleteExtender">
</cc1:AutoCompleteExtender>
2) You can change the Web Service that the AutoCompleteExtender Talks to by using the Following JavaScript.
 
function ChangeServicePath(){
        var autoComplete = $find("autoCompleteExtender");
        autoComplete.set_servicePath( <NewServicePath>);
        }
 
As you can see the $find  method is called on the behaviourID of the AutoCompleteExtender.
The "set_servicePath" method allows you to Set the path to the Web Service that the Extender talks to .
3) You can change the Web Service that the AutoCompleteExtender Talks to by using the Following JavaScript.
function ChangeServiceMethod(){
        var autoComplete = $find("autoCompleteExtender");
        autoComplete.set_serviceMethod( <NewServiceMethodName>);
        }
 
The "set_serviceMethod" method allows you to Set the path to the Web Service that the Extender talks to .
Hope this Helps 
 
Leave a Comment
  • Please add 2 and 1 and type the answer here:
  • Post
  • You've been kicked (a good thing) - Trackback from DotNetKicks.com

  • How would you handle the case where the extender is used in a templated databound control (e.g. Repeater)?

  • Good to see you in the blogging world!

  • Have you succeeded in using the $find function to get a reference of the extender?

    When I try to use it, autoComplete is still null. It doesn't seem to find it.

    Do I need to add any references or anything?

    Thanks

  • Hi Ilir,

    You should be able to get a handle to the Behavior of the ACE by using its Behavior ID , if it doesnt work , do you mind dropping me  a sample using the contact form ?

    I'll take a look at it and try to help out

  • Is it possible to attach one ACE to multiple Textbox controls on the page? I have a scenario where there are four fields on the page which call the same webservice and webmethod. Can I have just one ACE on the page for these controls and change the Target Control ID using Javascript?

    Thanks

  • Zolpidem and sleepwalking. Zolpidem eszopiclone indications. Zolpidem fedex. Zolpidem without prescription. Zolpidem.

  • Many thanks!

    I was getting crazy, javascript never found the autocompleteextender, the problem was with the property BehaviorID!!

Page 1 of 1 (8 items)