On the .ASPX page you'd put:
<asp
ropDownList id="listMyList" runat="server"></asp
ropDownList>
Then in your Code Behind Page (or your <script> tag) you'd have something
like this
Imports System.Data
Imports System.Configuration
Imports system.Data.OleDb
Imports System.IO
Protected WithEvents listMyList As System.Web.UI.WebControls.DropDownList
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' Check if page is loaded for the first time
If Not Page.IsPostBack Then
' Load the Various Lists on the Page
LoadLists()
End If
End Sub
' Private Method to load the Drop Down List
Private Sub LoadLists()
' load the drop down list
Dim sqlCon As New
OleDBConnection(ConfigurationSettings.AppSettings("ConString"))
Dim sqlStr As String = "SELECT * FROM TABLENAME"
Dim sqlCmd As New OleDBCommand(sqlStr, sqlCon)
Dim mylistReader As OleDBDataReader
Try
sqlCon.Open()
mylistReader =
sqlCmd.ExecuteReader(CommandBehavior.CloseConnection)
listMyList.Items.Add(New ListItem("Select a Choice", "0"))
' loop and add the items
While mylistReader.Read()
listMyList.Items.Add(New ListItem(mylistReader.GetString(1),
mylistReader.GetInt32(0).ToString()))
End While
listMyList.DataBind()
listMyList.SelectedIndex = 0
mylistReader.Close()
Catch ex As Exception
Finally
sqlCon.Dispose()
End Try
End Sub