在簡單的方法,我建議你使用UpdatePanel
。例如,
在ASPX,
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList runat="server" ID="dropDownOne">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="dropDownTwo" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
<asp:DropDownList runat="server" ID="dropDownTwo" AutoPostBack="true"
OnSelectedIndexChanged="Two_SelectedIndexChanged" ></asp:DropDownList>
在CS中,
protected void Two_SelectedIndexChanged(object sender, SelectedIndexChangedEventArgs e)
{
//......Rebind dropDownOne's datasource here !.....
}
在我的例子,dropDownTwo
將是您ID_dropdownList
和dropDownOne
將是你Name_DropDownList
。祝你好運 !
來源
2013-07-23 04:13:39
zey
我覺得這個案子不需要回帖。因爲你的'ID'和'Name'下拉列表已經包含了你需要的所有數據。你應該做的是'將'所有數據'加載到''''和'名稱'在'Page_Load'。然後在客戶端,使用'JQUERY'或'Javascript'來同步'ID'和'Name'的selectedIndex –
你能提供你的代碼嗎? –