문제

I have a texbox inside a templatefield in a gridview. For this textbox I have defined an autocompleteextender with its TargetControlID set to "myTextbox" which is working just fine. At the same time, for the OnClientItemSelected property I have defined a javascript function which should set the value of my textbox, but my question is how can I get the the name of this textbox using javascript?

My control snippet like this:

ajaxToolkit:AutoCompleteExtender TargetControlID="txtValue" onClientItemSelected="SetValue"

And my code looks like this:

function SetValue(sender, eventArgs){
  var TitleValue = eventArgs.get_value(); 
  /* do smth with this value */
  /* set the new value to my textbox ? */
}

Your suggestions and ideas are very much appreciated. Thank you a lot!

도움이 되었습니까?

해결책

You should be able to get the textbox control using:

sender.get_element()

For extenders, get_element() returns the targeted control, for script controls, it's the element that represents that control.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top