Change ServiceMethods and Web Service for the AutoCompleteExtender From Client Side

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