Ø
Øyvind Isaksen
When I bind the dropdownlist-control to a datareader, it displays all the
data (from the database) in the dropdownlist.
My question is:
How do I insert a "<option value="">Choose...</option>" in the top of the
dropdownlist? I want the first choice in the dropdownlist to be "blank" (no
value), just display a text like "Choose"...
This is the code that bind the dropdownlist to the datareader:
cmd.Connection.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader
Me.drpCompany.DataSource = dr
Me.drpCompany.DataTextField = "company"
Me.drpCompany.DataValueField = "companyID"
Me.drpCompany.DataBind()
cmd.Connection.Close()
Thanks for all tips
data (from the database) in the dropdownlist.
My question is:
How do I insert a "<option value="">Choose...</option>" in the top of the
dropdownlist? I want the first choice in the dropdownlist to be "blank" (no
value), just display a text like "Choose"...
This is the code that bind the dropdownlist to the datareader:
cmd.Connection.Open()
Dim dr As SqlDataReader = cmd.ExecuteReader
Me.drpCompany.DataSource = dr
Me.drpCompany.DataTextField = "company"
Me.drpCompany.DataValueField = "companyID"
Me.drpCompany.DataBind()
cmd.Connection.Close()
Thanks for all tips