我有4個下拉列表。當我更改第一個下拉列表時,onselectindexchangedchanged我需要更改所有剩餘的下拉值。 我正在處理它,但我只能更改onselectindexchanged的相應或下一個下拉值。請給我提供任何示例或指導我獲得任何良好的鏈接。 請幫助..在此先感謝。多個下拉列表
Q
多個下拉列表
2
A
回答
3
您需要將所有下拉菜單的AutoPostBack設置爲true,並且需要爲前三個下拉菜單添加SelectedIndexChanged事件。在第一個下拉列表的SelectedIndexChanged中,您需要設置第二個選定值,它將觸發第二個SelectedIndexChanged,並且您將有代碼設置第三個選定索引,並且類似地,您將在病房中完成。
在HTML中
<asp:DropDownList ID="dropdownlist1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropdownlist1_SelectedIndexChanged">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="dropdownlist2" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropdownlist2_SelectedIndexChanged">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="dropdownlist3" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropdownlist3_SelectedIndexChanged">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="dropdownlist4" runat="server" AutoPostBack="true" >
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
</asp:DropDownList>
在後面的代碼
protected void dropdownlist1_SelectedIndexChanged(object sender, EventArgs e)
{
dropdownlist2.SelectedIndex = someIndexValue;
}
protected void dropdownlist2_SelectedIndexChanged(object sender, EventArgs e)
{
dropdownlist3.SelectedIndex = someIndexValue;
}
protected void dropdownlist3_SelectedIndexChanged(object sender, EventArgs e)
{
dropdownlist4.SelectedIndex = someIndexValue;
}
相關問題
- 1. AngularJS:多個下拉列表
- 2. 在多個下拉列表
- 3. 多對多下拉列表
- 4. 從MVC中的一個下拉列表更改(多個)下拉列表的值
- 5. 過濾SqlDataSource與多個下拉列表
- 6. 有多個選擇的下拉列表
- 7. Z索引和多個下拉列表
- 8. 配置多個kendo-ui下拉列表
- 9. jquery +驗證多個下拉列表
- 10. Php多個搜索下拉列表
- 11. PHPExcel多個下拉列表,依賴於
- 12. jquery ajax多個下拉列表事件
- 13. VB.NET:處理多個下拉列表
- 14. 多個選擇下拉列表控件
- 15. jQuery多個下拉列表驗證
- 16. ViewBag多個SelectList下拉列表
- 17. 下拉列表中的多個項目
- 18. 多個下拉列表與PHP和MySQL
- 19. 多個下拉列表中的數據
- 20. 多個下拉列表 - onclick不關閉
- 21. 如何綁定多個下拉列表
- 22. PHP過濾器(多個下拉列表)
- 23. 多選下拉列表
- 24. 多級下拉列表,Qt
- 25. tablesort多選下拉列表
- 26. 多值下拉列表
- 27. Reactjs多下拉列表
- 28. php多選下拉列表
- 29. 多級下拉列表
- 30. Bootstrap下拉JavaScript不起作用的多個下拉列表
什麼剩餘價值下拉菜單需要改變嗎? –
請向我們展示您的相關代碼。這將有助於指出問題。 – Cdeez
它需要更改爲默認值。 – user1613212