Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Populate1()
Populate2()
End Sub
Public Sub Populate1()
Dim cmd As New SqlCommand("SELECT * FROM [tblOne]", New SqlConnection(ConfigurationManager.AppSettings("ConnString")))
cmd.Connection.Open()
Dim ddlValues As SqlDataReader
ddlValues = cmd.ExecuteReader()
DropDownList1.DataSource = ddlValues
DropDownList1.DataValueField = "theName"
DropDownList1.DataTextField = "theName"
DropDownList1.DataBind()
cmd.Connection.Close()
cmd.Connection.Dispose()
End Sub
Public Sub Populate2()
Dim cmd As New SqlCommand("SELECT * FROM [tblOne]", New SqlConnection(ConfigurationManager.AppSettings("ConnString")))
cmd.Connection.Open()
Dim ddlValues As SqlDataReader
ddlValues = cmd.ExecuteReader()
DropDownList2.DataSource = ddlValues
DropDownList2.DataValueField = "theCity"
DropDownList2.DataTextField = "theCity"
DropDownList2.DataBind()
cmd.Connection.Close()
cmd.Connection.Dispose()
End Sub
End Class