How can I change the TargetControlID on the client side of AutoCompleteExtender (javascript)?

Typically, I can set the server side of TargetControlID using something like this:

    AutoCompleteExtender ace = new AutoCompleteExtender();
    ace.ID = "AutoCompleteExtender1";
    ace.TargetControlID = "whatever";

I know how to capture the client side of AutoCompleteExtender, but I'm looking for a method to update the client side of TargetControlID. Any ideas?

+3
source share
2 answers

Apparently, Microsoft did not think this was important, so there is currently no way to do this :)

0
source

Well, unfortunately, this is not possible for an existing instance of AutoCompleteExtender. There are several methods that may interest you, for example below

var x = $find("AutocompleteBehaviorID");//find the instance

x.get_completionListElementID();//get the ID of target textbox

x.set_completionListElementID();//set the ID of target textbox has no effect though :(

x._completionListElement();//direct access to DOM element that acts as target

, init ( init). ( ), keypress, blur .. , . javascript, , .

$create(Behavior,{properties},{events},interfaces,target);

AjaxControlToolkit.AutoCompleteBehavior

- javascript, ( ,

{
    "completionInterval": 1,
    "completionListElementID": "empty panel id",
    "completionListItemCssClass": "css class name",
    "delimiterCharacters": ";",
    "highlightedItemCssClass": "css class name",
    "id": "CLIENTSIDEID",
    "minimumPrefixLength": 1,
    "serviceMethod": "WebMethodName",
    "servicePath": "AbsolutePath to asmx file"
}

{
    "itemSelected": jsFn,
    "populated": jsFn
}

. , .

$get("ELEMENT ID")

, , , javascript . , .

+2

All Articles