DropDownList1.DataSource = ds; //绑定数据源
DropDownList1.DataTextField = "TypeName"; //文本内容字段
DropDownList1.DataValueField = "TypeId"; //值字段
DropDownList1.DataBind();
ds.Dispose();
取默认值
DropDownList1.SelectedValue = year.ToString();
DropDownList1.DataSource = ds; //绑定数据源
DropDownList1.DataTextField = "TypeName"; //文本内容字段
DropDownList1.DataValueField = "TypeId"; //值字段
DropDownList1.DataBind();
ds.Dispose();
取默认值
DropDownList1.SelectedValue = year.ToString();