Add a blank value for the first entry of a DropDownList

asp.net, c#

Solution

Set AppendDataBoundItems to true on the drop-down list and then add your default item to the list

<asp:DropDownList ID="ddlOne" runat="server" AppendDataBoundItems="True" 
        DataSourceID="" DataTextField="" DataValueField="">
            <asp:ListItem Value="">Please Select</asp:ListItem>
</asp:DropDownList>

This will result in all your data-bound values being added to the dropdown after the ones you have specified in the markup above

Problem

I have a DropDownList that is data bounds to a SQL Server Data Source. As it is, the first entry from the data source is the first entry selected by default. In order to select this entry (and have the DropDownList_SelectedIndexChange() function be called), I have to select the second option, and then the first option again. Is there a way to enter an invalid item into the DropDownList as the first item, sort of as a "default value"?

Original source