How to trigger DropDownList SelectedIndexChanged if I select the same option(the same index)?

173 Views Asked by At

As title, in C#, I was wondering that if I selected the same index in a dropdownlist, how could I trigger the function (OnSelectedIndexChanged)?

<asp:DropDownList ID="ddlColor" runat="server" Width="100%" AutoPostBack="True" OnSelectedIndexChanged="ddlColor_SelectedIndexChanged" >
    <asp:ListItem Selected="True" Value="White"> White </asp:ListItem>
    <asp:ListItem Value="Silver"> Silver </asp:ListItem>
    <asp:ListItem Value="DarkGray"> Dark Gray </asp:ListItem>
    <asp:ListItem Value="Khaki"> Khaki </asp:ListItem>
    <asp:ListItem Value="DarkKhaki"> Dark Khaki </asp:ListItem>
</asp:DropDownList> 

There is a scenario as below following: I selected "White" at first, and it triggered ddlColor_SelectedIndexChanged successfully.

Then as need I selected "White" again, how could I trigger the function ddlColor_SelectedIndexChanged again?

0

There are 0 best solutions below