我想顯示/隱藏ddlDuration的某些值,這些值將根據我想要的ddlLOanType而改變。例如,如果他們從我的下拉列表中選擇個人貸款類型,我希望它顯示ddlDuration中的所有值,如果我選擇新車貸款,我希望它顯示這些值「36,48,60」。我不確定我應該使用什麼。感謝您的幫助顯示/隱藏其他下拉列表值的下拉列表值已更改
Type: <asp:DropDownList ID="ddlLoanType" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlLoanType_SelectedIndexChanged">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">Personal Loan</asp:ListItem>
<asp:ListItem Value="2">New Car Loan</asp:ListItem>
<asp:ListItem Value="3">Used Car Loan</asp:ListItem>
</asp:DropDownList>
Duration:<asp:DropDownList ID="ddlDuration" runat="server"
onselectedindexchanged="ddlDuration_SelectedIndexChanged"
AutoPostBack="True">
<asp:ListItem Value="12">12</asp:ListItem>
<asp:ListItem Value="24">24</asp:ListItem>
<asp:ListItem Value="36">36</asp:ListItem>
<asp:ListItem Value="48">48</asp:ListItem>
<asp:ListItem Value="60">60</asp:ListItem>
</asp:DropDownList>
ddlLoanType_SelectedIndexChanged on this event bind your ddDDuration dropdown instead of show and hide the values。 – rach