Using a DropDownList on a Web Form
Posted on 2005-03-02
I am new to using VS.net and have a two part question. First I want to add a combo box control to one of my webforms. I have noticed that the webform tool box does not have a "combo box" control. I have tried using the DropDownList to display display the data I want but the following is displayed instead, "System.Data.DataRowView". First, can I used a dropdownlist to display data on a webform? Second, if I can, any ideas what i am doing wrong? Below is the code that I am using to populate the dropdownlist:
Data_Path = "C:\Data\Visual_Studio_Project\Exhibitor_Manager\_Databases\dbExhibitor_Manager.mdb"
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Data_Path & ";User Id=admin;Password=;"
strSQL = "SELECT tblStates.State_Name FROM tblStates ORDER BY tblStates.State_Name;"
Dim cn As New OleDb.OleDbConnection(strConn)
Dim da As New OleDb.OleDbDataAdapter(strSQL, cn)
Dim ds As New DataSet
Me.DropDownList.DataSource = ds
I am reading the data from an Miscrosoft Access Database.
Thanks for your help.