Hi,
Here's a small sample:
SqlConnection con = new SqlConnection("SOME CONNECTION STRING HERE");
SqlCommand cmd = new SqlCommand("select FieldName from TableName", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "FieldName"; // FieldName of Table in DataBase
DropDownList1.DataValueField = "FieldName"; // FieldName of Table in DataBase
DropDownList1.DataBind();
Read more about the datasource property here:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.basedataboundcontrol.datasource.aspx[
^]
If you need to set one of the element to selected then after binding (could be the databound event of teh dropdownlist) you can find the correct element and set it to selected.
Regards
Joachim