0

I have an autocompleteextender which works very fine when i set its innerHtml to text received from the webservice a i can catch the selected value of that text on selectedItem function . but when i set some HTML elements inside innerHtml of the childnode i loss the value of that node on selectedItem function (to keep on mind that i can see set value on OnClientPopulated function !).

here is OnClientPopulated

function PopulateDataForAce_Locations(sender) {
            $("#tbxLocation").css("background-image", "none");

            var comletionList = $find("aceYer").get_completionList();
            for (var i = 0; i < comletionList.childNodes.length; i++) {
                var data = JSON.parse(comletionList.childNodes[i].innerText);
                var image = data[0];
                var imageClass = "";
                var textClass = "";
                if (data[1].indexOf("##") > -1 || comletionList.childNodes[i]._value == "0000") {
                    imageClass = "imageStyleIlce";
                    textClass = "textStyleIlce";
                }
                else {
                    imageClass = "imageStyleIl";
                    textClass = "textStyleIl";
                }
                var text = data[1].replace("##", "");
                var text2 = data[2];

              // comletionList.childNodes[i].innerHTML = "<font class=\"" + textClass + "\">" + text + "</font>";
                comletionList.childNodes[i].innerHTML =  text;
            }
        }

when i use the comment line i lose the value of the node. any help is appreciated

MuhanadY
  • 752
  • 1
  • 12
  • 40

1 Answers1

0

the only way that i found to get the value on selected item function was

 function aceLocation_itemSelected(sender, e) {
            var index = $find("aceYer")._selectIndex;
            var _item = $find("aceYer").get_completionList().childNodes[index];
            var hfYer = $get('<%= hfYer.ClientID %>');
            hfYer.value = _item._value; 
        }

while e.get_value() did not work with html item.

MuhanadY
  • 752
  • 1
  • 12
  • 40