DropDownList应用

这两天我用了dropdownlist这个控件,一开始真的什么都不懂。

将数据源绑定到dropdownlist中
#region 初始化选择框
private void BindData()
{

this.DropDownList_STANDARD_TYPE.Items.Clear();
DataSet standard_type
= dal.STANDARD_TYPE_MANAGE_LIST();

this.DropDownList_STANDARD_TYPE.DataSource = standard_type.Tables[0].DefaultView;
this.DropDownList_STANDARD_TYPE.DataTextField = "STANDARD_TYPE_NAME";
this.DropDownList_STANDARD_TYPE.DataValueField = "STANDARD_TYPE_ID";
this.DropDownList_STANDARD_TYPE.DataBind();
//this.DropDownList_STANDARD_TYPE.Items.Insert(0, new ListItem("请选择", ""));


//this.STANDARD_TYPE.SelectedItem.Value = standard_type.Tables[0].Rows[0]["STANDARD_TYPE_NAME"].ToString();



}
#endregion

posted @ 2011-04-20 16:17  .windy  阅读(162)  评论(0编辑  收藏  举报