Append Blank Item to Databound Dropdown

I am looking to add a blank default item to a dropdown list in an form.
I can not add the item directly to the database in this situation.

I have tried the following code for the DropdownList however the item did not appear:

 <asp:DropDownList ID="C_DepartmentID" runat="server" AutoPostBack="True" DataSourceID="D_DEPTs"
                            DataTextField="Name" DataValueField="ID" Width="16em">
                                <asp:ListItem Value="0" Selected="true">Select Department</asp:ListItem>

I Then set the AppendDataBoundItems="True"  
This does make the blank item appear in the list, however the side effect is that if the conditions populating the list change- the list items from the new parameters are appended to the old and both can be selected. This can obviously cause some big problems.

 Is there a fix for this side effect, or perhaps another method of adding this blank default ?
As always thank you for your help!

Who is Participating?
in page load

if not ispostback() then
  DepartmentID.Items.Insert(0, "Select department")
end if

In instances such as the one you present I use a UNION statement in my SQL to add an aditional SELECT statment with hard coded values that provide the column you need, for example
SELECT 'Select Department' as Name, 0 as Value
SELECT Name, Value FROM Table

I'm not sure if this would contravean your statment about not adding to the database though?
apocalypse910Author Commented:
I sincerely apologize for the delay in getting back to you. i got involved in another project and hadn't had a chance to work on this issue for a bit. Thank you very much for your time and the excellent solutions.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.