I have a dropdown list on aspx page that is using a data source select command to pull from a database. The don't any data in the dropdown when I preview the page. I need help on what I am doing wrong. Here is my code for the dropdown list and data source:

<asp:DropDownList runat="server" id="DropDownList2" AutoPostBack="true"   DataValueField="POPULATION_LIST_ID" DataSourceID="sdsLastName" DataTextField="Last_Name"  Visible="True"  Height="26px" >  

<asp:SqlDataSource runat="server" id="sdsLastName" SelectCommand="SELECT DISTINCT LAST_NAME FROM CHP_POPULATION_LIST" ProviderName="System.Data.OracleClient" ConnectionString="Data Source=cora;Persist Security Info=True;User ID=catdb;Password=ca222tdb;Unicode=True">   
	<asp:controlparameter ControlID="DropDownList2" PropertyName="SelectedValue" Name="LAST_NAME" />

Recommended Answers

All 2 Replies

somehow your Datasource to the DropDown list Box...
I am not familiar with using the Drag on DataSource but heres one way that might solve ur problem.

as a global declration create and populate your DataSet(myDataSet)

on The Code behind of aspx(Page load event) add the followoing code.
Dataset getSet = myDataSet();

if(! IsPostBack)
DDListBox.DataTextField="Your DTF Name";
DDDropBox.DataSource =myDataSet;

The Third line(DataBind) is your problem and adding it should Bind your Data to the DropDownBox instantly.........

your problem is your not selecting the POPULATION_LIST_ID in your SELECT Statment


You should be fine after this, remove your <select parameters> too as you don't need them here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.