<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True"
onselectedindexchanged="ListBox1_SelectedIndexChanged">
<asp:ListItem>测试</asp:ListItem>
<asp:ListItem>测试2</asp:ListItem>
</asp:ListBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
后台代码:
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (ListBox1.SelectedValue!=null)
{
TextBox1.Text = ListBox1.SelectedValue;
}
}
温馨提示:内容为网友见解,仅供参考