Changing a user created control based on content of input from JS tied textbox
I want to change a user created control based on content of the input inside of textbox tied to JS.
My user control has an attribute field titled "userInput" where I pass the content of the textbox.
My page looks like this:
The textbox has an autocompleteextender and a Javascript function runs when an item from the dropdown is selected.
How do I pass the selected value back to the server so that my ascx user开发者_如何学运维 control can be updated with the appropriate data. (corresponding to what is in the textbox)
Assume that updatepanels/scriptmanagers are set up correctly (they are :-) )
Assuming you have an update panel around your custom ascx. Set up a trigger on that update panel that comes from the TextChanged event of your text box then set AutoPostback = true on the textbox. On the server, you can subscribe to the text changed event of the text box and write the code there to change the contents of the user control.
精彩评论