ASPX Dropdownlist

  • 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
 
hi Sean,

look at http://samples.gotdotnet.com/quickstart/aspplus/ for a lot of
samples..

for your ddl problem:

DropDownList ddl = new DropDownList();
ddl.DataSource = yourDataTable; /// can also be a DataSet
ddl.DataTextField = "NameOfFieldWhichContainsText";
ddl.DataValueField ="NameOfFieldWhichContainsValue";
ddl.DataBind(); /// get the values from the DataSource

that should do the trick
regards
karten
 
Back
Top