62,267
社区成员
发帖
与我相关
我的任务
分享
<asp:DropDownList ID="DropDownList1" runat="server" >
<asp:ListItem Text="0" Value="0"></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
<asp:ListItem Text="4" Value="4"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
$(function () {
$('#<%=DropDownList1.ClientID%>').change(function () {
$('#<%=TextBox1.ClientID%>').val($('#<%=DropDownList1.ClientID%>').find("option:selected").val());
});
});
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Text="0" Value="0"></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
<asp:ListItem Text="4" Value="4"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
$(function(){
$('#<%=DropDownList1.ClientID%>').change(function(){
$('#<%=TextBox1.ClientID%>').val($('#<%=DropDownList1.ClientID%>').find("option:selected").val());
});
});
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Text="0" Value="0"></asp:ListItem>
<asp:ListItem Text="1" Value="1"></asp:ListItem>
<asp:ListItem Text="2" Value="2"></asp:ListItem>
<asp:ListItem Text="3" Value="3"></asp:ListItem>
<asp:ListItem Text="4" Value="4"></asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
//TextBox1.Text = DropDownList1.SelectedValue; //选中项的Value
TextBox1.Text = DropDownList1.SelectedItem.Text; //选中项的Text
}