C# 多下拉列表
我有4个下拉列表。更改第一个下拉列表时,onselectindexchanged需要更改所有剩余的下拉列表值。 我正在处理它,但我只能更改onselectindexchanged上对应的或下一个下拉列表值。请给我提供任何例子或指导我到任何好的链接。C# 多下拉列表,c#,asp.net,selectedindexchanged,C#,Asp.net,Selectedindexchanged,我有4个下拉列表。更改第一个下拉列表时,onselectindexchanged需要更改所有剩余的下拉列表值。 我正在处理它,但我只能更改onselectindexchanged上对应的或下一个下拉列表值。请给我提供任何例子或指导我到任何好的链接。 请帮忙。。提前谢谢 您需要将所有下拉列表的AutoPostBack设置为true,并需要为前三个下拉列表添加SelectedIndexChanged事件。在第一个下拉列表的SelectedIndexChanged上,您需要设置second的Selec
请帮忙。。提前谢谢 您需要将所有下拉列表的AutoPostBack设置为true,并需要为前三个下拉列表添加SelectedIndexChanged事件。在第一个下拉列表的SelectedIndexChanged上,您需要设置second的SelectedIndexChanged值,它将触发second的SelectedIndexChanged,在那里您将有代码设置second的SelectedIndexChanged,类似地,您将在wards上执行此操作 在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>
其余的下拉列表值还需要更改什么?请向我们显示您的相关代码。这将有助于指出问题所在。它需要更改为默认值。哦。。我很抱歉。。。我忘了,因为我很高兴P
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;
}