Return to Snippet

Revision: 33698
at November 7, 2010 02:02 by derebus


Updated Code
ddlAuthor.DataTextField = "FullName"
ddlAuthor.DataValueField = "AuthorID"
ddlAuthor.DataSource = authorDB.GetAuthors()
ddlAuthor.DataBind()
'ERROR ---> ddlAuthor.Items.Insert(0, "-- Select Author --")
ddlAuthor.Items.Insert(0, New ListItem("-- Select Author --", "0"))

Revision: 33697
at October 12, 2010 07:36 by derebus


Initial Code
ddlAuthor.DataTextField = "FullName"
ddlAuthor.DataValueField = "AuthorID"
ddlAuthor.DataSource = authorDB.GetAuthors()
ddlAuthor.DataBind()
ddlAuthor.Items.Insert(0, "-- Select Author --")

Initial URL
http://digitalcolony.com/2007/03/add-item-to-dropdownlist-after-databind.aspx

Initial Description
Add Item to DropDownList After DataBind

Initial Title
Add default value for dropdownlist

Initial Tags

                                

Initial Language
VB.NET