Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Dropdownlist,在所有选择上回发_C#_Asp.net_Drop Down Menu - Fatal编程技术网

C# Dropdownlist,在所有选择上回发

C# Dropdownlist,在所有选择上回发,c#,asp.net,drop-down-menu,C#,Asp.net,Drop Down Menu,我想知道是否有可能,使用asp:dropdownlist,如果你可以对每个选择都进行回发,即使是相同的?例如: <asp:DropDownList ID="DropDownList_SortCars" runat="server" OnSelectedIndexChanged="DropDownList_SortCars"> <asp:ListItem Value="0" Text="Volvo" ></asp:ListItem> <asp:ListIt

我想知道是否有可能,使用asp:dropdownlist,如果你可以对每个选择都进行回发,即使是相同的?例如:

<asp:DropDownList ID="DropDownList_SortCars" runat="server" OnSelectedIndexChanged="DropDownList_SortCars">
<asp:ListItem Value="0" Text="Volvo" ></asp:ListItem>
<asp:ListItem Value="1" Text="Saab"></asp:ListItem>
<asp:ListItem Value="2" Text="Audi"></asp:ListItem>
</asp:DropDownList>
因此,与“OnSelectedindexChanged”事件不同,您将使用IndexSelected事件。原因是什么?好吧,如果有人选择了沃尔沃,这将是一个模型列表或其他东西,如果他们再次选择沃尔沃,它将显示相同的列表,但顺序相反!目前,我只能在他们更改索引的情况下让列表启动


因此,基本上你可以强制回发选择,任何选择?

我可以知道,对每个选择进行回发的目的是什么吗。通常,这个selectedindexchanged适用于我到目前为止处理的场景。我们来看看两个不同的下拉列表控件如何:一个用于品牌列表,另一个用于基于所选品牌的型号列表?这只是一个示例,但没有一个列表,a-z,再次选择z-a。