这两天我用了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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
相关资源
相似解决方案