0

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:DropDownList>

<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">   
   <SelectParameters>
	<asp:controlparameter ControlID="DropDownList2" PropertyName="SelectedValue" Name="LAST_NAME" />
	</SelectParameters>
   </asp:SqlDataSource>
3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by MichaelWClark
0

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;
DropDownBox.DataBind();
}

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

0

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

::
SelectCommand="SELECT DISTINCT LAST_NAME,POPULATION_LIST_ID FROM CHP_POPULATION_LIST"

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.