0
嗨,我正在開發一個asp.net的Web應用程序,因爲我創建一個註冊表單。在註冊表格頁面上,我有三個名爲國家,州,城市的Dropdownlists。 因此,當用戶選擇任何國家時,該國的州將顯示在狀態的下拉列表中,以及用戶從州下拉列表中選擇州時,他可以在下拉列表中看到城市列表。層疊dropdownlist沒有重新加載頁面在asp.net
我已經實現了該功能,但是當用戶在下拉列表中選擇值時,會發生回發。 在我的情況下,我不想在用戶選擇國家或州時重新加載頁面,所以我試圖通過使用ajax工具包來實現相同的功能。但我無法使用ajax實現相同的功能。
所以簡而言之,我的問題是:從asp.net中的dropdownlist中選擇國家,州和城市,無需重新加載頁面。
在這裏,我給你的ASPX部分。
請幫幫我。
CountryDropDown
<asp:DropDownList ID="DropDownListCountry" runat="server" Enabled="false"
OnSelectedIndexChanged="DropDownListCountry_OnSelectedIndexChanged"
AutoPostBack ="false">
<asp:ListItem>India</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:DropDownList>
StateDropDown
<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="DropDownListCountry" EventName="OnSelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:DropDownList runat="server" ID="DropDownListState" Enabled="false"
OnSelectedIndexChanged="DropDownListState_OnSelectedIndexChanged">
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
研究.NET Web方法。基本上是ajax調用來執行代碼隱藏功能。 [這裏是一個例子](http://stackoverflow.com/questions/14631238/pass-and-return-a-string-into-vb-net-web-method) – ElliotM
你的代碼看起來不錯。你得到什麼錯誤? –
我沒有收到任何錯誤,但我無法實現所需的功能。 –