【发布时间】:2017-01-12 09:51:41
【问题描述】:
我有一个简单的下拉列表,其中有 3 个选项可供选择,下面还有一个文本框。用户选择一个选项后,我需要将其值作为文本插入到文本框中 - 如果客户选择“Employee 1”,“TextBoxEmployee”将填充“1”,依此类推。
<asp:DropDownList runat="server" ID="Assigned_Employee">
<asp:ListItem Value="1" Text="Employee 1">Employee 1</asp:ListItem>
<asp:ListItem Value="2" Text="Employee 2">Employee 2</asp:ListItem>
<asp:ListItem Value="3" Text="Employee 3">Employee 3</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBoxEmployee" runat="server"/>
你能推荐最简单的方法吗?我可以使用 jQuery 吗?感谢您的帮助:)
【问题讨论】:
-
$('#Assigned_Employee').change(function(){ $('#TextBoxEmployee').val(this.value);}
标签: jquery asp.net drop-down-menu textbox dropdown