Reputation: 3243
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!
Upvotes: 4
Views: 3512
Reputation: 50728
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.
Upvotes: 6