ASPX Dropdownlist (datasource)

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi,

I have an ASPX Dropdown list.

I am unsure how to set my datasource.

I have a table that has 2 columns, an identity column and
a description column.

Has anyone got some sample code on how to do this.

I find it hard to get any sample code on the web.

Thanks,
Sean
 
Heres one way of doing it in c#

for simplicity my drop down list is called ddl and my data
source is a dataset called DS

ddl.DataValueField = "ValueField";
ddl.DataTextField = "TextField";
ddl.DataSource = DS.Tables[0].DefaultView;
ddl.DataBind();

hope this helps.
 
Back
Top