Get the TargetControlId of an autocomputer in the OnClientItemSelected Javascript function

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

My control snippet is as follows:

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 greatly appreciated. Thank you very much!

+4
source share
1 answer

You can get a text box control using:

 sender.get_element() 

For expanders, get_element() returns the target control for the script controls; this is the element that represents this control.

+6
source

Source: https://habr.com/ru/post/1386510/


All Articles