I have dropdownlist control where item lists are coming from database
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
        DataSourceID="SqlDataSource2" DataTextField="semester" 
        DataValueField="semester">
    </asp:DropDownList>
But I want to add at the beginning 1 list item more "ALL" .. How can I add this one .
Thanks !
To add a new list item to the DropDownList, in the Properties window, click on the ellipses in the Items property. Add a new list item with Text "ALL" & Value -1.
Or you can add the list item by adding this markup to the DropDownList:
<asp:DropDownList ID="categories" runat="server" ...>
    <asp:ListItem Value="-1">
       ALL
    </asp:ListItem>         
</asp:DropDownList>
Set the DropDownList's AppendDataBoundItems=True 
With Items.Insert method you can add an item at a specific index :
DropDownList1.Items.Insert(0, new ListItem("ALL", "ALL"));
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With