Changing a user created control based on content of input from JS tied textbox

主宰稳场 提交于 2019-12-13 18:18:55

问题


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 :-) )


回答1:


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.



来源:https://stackoverflow.com/questions/1640760/changing-a-user-created-control-based-on-content-of-input-from-js-tied-textbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!