To disable or stop the AutoCompleteExtender from running or calling its service to load auto suggested list, (Using Javascript)
Its very simple
-Set the BehaviorID property for the AutoCompleteExtender
<ajaxToolkit:AutoCompleteExtender
runat="server"
ID="autoSuggest"
TargetControlID="SearchBox"
ServiceMethod="GetSuggestedList"
ServicePath="~/_Services/AutoSuggest.asmx"
MinimumPrefixLength="2"
CompletionInterval="1"
EnableCaching="true"
CompletionSetCount="10"
CompletionListCssClass="AutoSuggestSearch"
CompletionListItemCssClass="listItem"
CompletionListHighlightedItemCssClass="highlightedListItem"
BehaviorID="autoSuggest"
/>
Then using javascript just write:
function selectType()
{
var a = $find("autoSuggest");
a.set_serviceMethod('');
}
By setting the service method to empty, the autosuggestextender will not find the service to call and will stop working
3 comments:
Hello,
I tried you code. But it didnt worked for me. The autocomplete is showing the list.
Can you please help me?
Thanks,
You will need to call this function:
function selectType()
{
var a = $find("autoSuggest");
a.set_serviceMethod('');
}
such as putting it in a:
a href="javascript:selectType();" Stop /a
i want to disable Auto complete extender like userID is stroe in browser in userID textbox
Post a Comment