EricaStar
12-11-2006, 10:35 PM
I have a drop down list named ddCats. It's datasource is a public function called GetCatagories(). Here is the code for the function:
Public Function GetCategories() As DataSet
Dim myAuthenticate As New myAuth
Dim myConn As New MySql.Data.MySqlClient.MySqlConnection(myAuthenticate.DecryptConnectionString)
myConn.Open()
'Populate the ddlDataSet
Const strSQLDDL As String = "select lookup_value,lookup_id,ShortName from lookup where lookup_id = 'categoryID'"
Dim myDataAdapter As New MySql.Data.MySqlClient.MySqlDataAdapter(strSQLDDL, myConn)
myDataAdapter.Fill(ddlDataSet, "Categories")
Return ddlDataSet
End Function
ddlDataSet is declared as a global variable.
Why is the drop down list showing up empty. The select statement when ran directly against the mySql table returns 4 records. Here is the relevant HTML:
<asp:DropDownList id=ddCats runat="server" Visible="False" Width="158px" DataTextField="ShortName" DataValueField="lookup_value" DataSource="<%# GetCategories() %>"></asp:DropDownList>
Why is the dropdownlist empty when it is displayed?
Public Function GetCategories() As DataSet
Dim myAuthenticate As New myAuth
Dim myConn As New MySql.Data.MySqlClient.MySqlConnection(myAuthenticate.DecryptConnectionString)
myConn.Open()
'Populate the ddlDataSet
Const strSQLDDL As String = "select lookup_value,lookup_id,ShortName from lookup where lookup_id = 'categoryID'"
Dim myDataAdapter As New MySql.Data.MySqlClient.MySqlDataAdapter(strSQLDDL, myConn)
myDataAdapter.Fill(ddlDataSet, "Categories")
Return ddlDataSet
End Function
ddlDataSet is declared as a global variable.
Why is the drop down list showing up empty. The select statement when ran directly against the mySql table returns 4 records. Here is the relevant HTML:
<asp:DropDownList id=ddCats runat="server" Visible="False" Width="158px" DataTextField="ShortName" DataValueField="lookup_value" DataSource="<%# GetCategories() %>"></asp:DropDownList>
Why is the dropdownlist empty when it is displayed?