<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" onselectedindexchanged="DropDownList1_SelectedIndexChanged"> <asp:ListItem>---Select color--</asp:ListItem> <asp:ListItem>Red</asp:ListItem> <asp:ListItem>Green</asp:ListItem> <asp:ListItem>Blue</asp:ListItem> </asp:DropDownList>
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedIndex != 0) { DropDownList1.Items.Remove("---Select color--"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)