bencooke
Nov 9th, 2004, 05:37 AM
Hi there,
I have a dropdownlist at the top pf my page I wish to be populated so that all the values are a particular column from my SQL query and all the text valeus ie what the user sees are from another column.
I have set up the connetion and a datatable ok, i think but am having problems. my code:
Dim myTable As New DataTable("myContactsTable")
Dim myOtherTable As New DataTable("myDDLTable")
objDataSet.Tables.Add(myTable)
objDataSet.Tables.Add(myOtherTable)
myContacts.DataSource = objDataSet.Tables("myContacts")
myContacts.DataBind()
myDDL.DataSource = myOtherTable
myDDL.DataBind()
... then later on :
<asp:DropDownList id="myDDL" runat="server"
DataValueField='Container.DataItem("countryCode")'
DataTextField='Container.DataItem("country")'
AutoPostBack="True">
</asp:DropDownList>
All I get is a blank dropdown list on the page :( can anyone help me?
thanks,
beNcooKe
I have a dropdownlist at the top pf my page I wish to be populated so that all the values are a particular column from my SQL query and all the text valeus ie what the user sees are from another column.
I have set up the connetion and a datatable ok, i think but am having problems. my code:
Dim myTable As New DataTable("myContactsTable")
Dim myOtherTable As New DataTable("myDDLTable")
objDataSet.Tables.Add(myTable)
objDataSet.Tables.Add(myOtherTable)
myContacts.DataSource = objDataSet.Tables("myContacts")
myContacts.DataBind()
myDDL.DataSource = myOtherTable
myDDL.DataBind()
... then later on :
<asp:DropDownList id="myDDL" runat="server"
DataValueField='Container.DataItem("countryCode")'
DataTextField='Container.DataItem("country")'
AutoPostBack="True">
</asp:DropDownList>
All I get is a blank dropdown list on the page :( can anyone help me?
thanks,
beNcooKe