dropdown

N

NuB

I'm creating a web form in ASP.NET 2.0 (VB), and on my form I have several
drop downs being populated from the database. When my page loads the drop
downs are showing the data right way, and not my "Select a State" its
showing AL right away, how can I add "Select a State" in the drop down so
the user sees that first and not AL?
 
A

Andrew Robinson

<asp:DropDownList ID="DropDownList1" runat="server"
AppendDataBoundItems="True">

<asp:ListItem>Select State</asp:ListItem>

</asp:DropDownList>



Set the AppendDataBoundItems property to true. DataBind in code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top