如何从下拉列表中获取值以返回到 TextBox?以下不起作用。您可以从列表中选择项目。
<body>
<form id="form1" runat="server">
<script type="text/javascript">
function pageLoad() {
//Same Width
$get('ListBox1').style.width = $get('TextBox1').clientWidth;
}
</script>
<ajax:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</ajax:ToolkitScriptManager>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ajax:DropDownExtender ID="TextBox1_DropDownExtender" DropDownControlID="ListBox1"
runat="server" DynamicServicePath="" Enabled="True" TargetControlID="TextBox1"
HighlightBackColor="WhiteSmoke">
</ajax:DropDownExtender>
</div>
<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True">
<asp:ListItem>Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
<asp:ListItem>Item 3</asp:ListItem>
</asp:ListBox>
</form>