Here's some code:
private void BindDropdownList()
{
ddlSector.DataSource = Sectors.GetAll();
ddlSector.DataTextField = "Name";
ddlSector.DataValueField = "ID";
ddlSector.DataBind();
}
Call the method BindDropdownList() in PageLoad.
Sectors.GetAll() returns a table. The table have two coloums: Name and ID.
"Joey Liang via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> skrev i
melding news:70******************************@DotNetMonste r.com...
Hi all,
I am new to ASP.NET, i have met some problems in binding data from a
table of database to a dropdown list control. Anyone knows how to do it?if
possible can rougly write the codes or any tutorials regarding
this...Thanx
in advance...
From,
Joey
--
Message posted via http://www.dotnetmonster.com