Can I set a databound drop down list to be blank on page load without changing the database?

Can I set a databound drop down list to be blank on page load without changing the database? If so how? Thanks
dwezilAsked:
Who is Participating?
 
dwezilConnect With a Mentor Author Commented:
AppendDataBoundItems works

<asp:DropDownList runat="server" AppendDataBoundItems="true">
    <asp:ListItem>- - SELECT SOMETHING - -</asp:ListItem>
</asp:DropDownList>
0
 
tomasgruenerCommented:
Surpress the databinding. Somewhere you have a part in the code, where you call Control.DataBind().

If you want enabling just for postbacks, then use something like this.


if(Page.IsPostBack)
    Control.DataBind();

Open in new window

0
 
Rupesh PCommented:
I assume you want to clear the control in page load. rt? If So,
DropDownList1.Items.Clear()
should do the job

0
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.