如何使用ASP.NET更新面板?
在我的asp.net应用程序中,我有两个dropdownlist,如果我选择第一个dropdownlist,则表示自动想要更改dropdownlist的值,但它不起作用。这是我的asp代码如何使用ASP.NET更新面板?,asp.net,c#-4.0,Asp.net,C# 4.0,在我的asp.net应用程序中,我有两个dropdownlist,如果我选择第一个dropdownlist,则表示自动想要更改dropdownlist的值,但它不起作用。这是我的asp代码 <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="State"></asp:Label>
<asp:DropDownList ID="ddlState" runat="server" Height="23px" Width="195px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
AutoPostBack="True">
<asp:ListItem>--Select--</asp:ListItem>
<asp:ListItem>Kerela</asp:ListItem>
<asp:ListItem>Tamilnadu</asp:ListItem>
<asp:ListItem>Karnataka</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="District"></asp:Label>
<asp:DropDownList ID="ddlDistrict" runat="server" Height="23px" Width="189px" AutoPostBack="True">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
--挑选--
喀拉拉
泰米尔纳德邦
卡纳塔克邦
我复制了您的代码,并将选定的索引更改事件定义为
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
ListItem li = new ListItem("text");
ddlDistrict.Items.Add(li);
}
它工作得很好。你可能还有其他问题。您能复制所选的索引更改事件代码吗?什么不起作用。请解释一下这个问题。此外,发布回发代码也很有用。请在
DropDownList1\u SelectedIndexChanged