更改用户创建的控件根据输入的JS绑文本框的内容控件、文本框、根据、内容

2023-09-10 21:46:25 作者:涐不是一般人

欲基于输入文本框绑的JS里面的内容更改用户创建的控件

I want to change a user created control based on content of the input inside of textbox tied to JS.

我的用户控件的属性字段名为userInput里我通过文本框的内容。

My user control has an attribute field titled "userInput" where I pass the content of the textbox.

我的页面看起来是这样的:

My page looks like this:

文本框有一个autocompleteextender当从下拉菜单中选择了一个项目一个Javascript函数运行。

The textbox has an autocompleteextender and a Javascript function runs when an item from the dropdown is selected.

我如何通过选定的值返回到服务器,这样,我的ASCX用户控件可以通过适当的数据进行更新。 (对应的是在文本框中)

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)

假设的UpdatePanel / scriptmanagers设置正确(他们是:-))

Assume that updatepanels/scriptmanagers are set up correctly (they are :-) )

推荐答案

假设你已经在你的自定义ASCX更新面板。设置一个触发器,更新面板来自文本框的TextChanged事件上然后设置自动回=在文本框中正确的。在服务器上,您可以订阅到文本框的文本改变事件,并写入code有改变用户控件的内容。

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.