Subject: Populating DropDownList from multiple sources
Posted By: hawkfb63 Post Date: 2/14/2006 5:17:37 PM
I am trying to populate a dropdown list with company names that are stored in a database.  I am able to do that fine.  I also want the dropdown list to have the default value be "New Company" so if they select no company, it will redirect them to a page where a new company profile can be created.  Any help on this would be greatly appreciated.
Luke

Reply By: Imar Reply Date: 2/14/2006 5:33:59 PM
Hi there,

You can set AppendDataBoundItems to True on the drop-down list, and the simply add the static item in the markup of the page.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Hospital Food by Eels (Track 6 from the album: Electro-shock Blues) What's This?
Reply By: adam_kahtava Reply Date: 2/14/2006 5:42:52 PM
The following link outlines a solution quite nicely..

http://weblogs.asp.net/scottgu/archive/2006/01/29/436804.aspx

In short you'll need to define an additional ListItem in your DropDownList.
<asp:DropDownList .... >
   <asp:ListItem Text="New Company" Value="" />
</asp:DropDownList>


- A.Kahtava

Go to topic 39864

Return to index page 370
Return to index page 369
Return to index page 368
Return to index page 367
Return to index page 366
Return to index page 365
Return to index page 364
Return to index page 363
Return to index page 362
Return to index page 361