asp.net中如何绑定combox下拉框数据(调用存储过程)
#region 绑定类型(商品类型、仓库名称)
public void DataType_Bind(int _peoid)
{
DataTable dt_goodsname = new DataTable();
dt_goodsname = stockbll.GetList_goodstype(_peoid).Tables[0]; //获取商品类别
this.cb_goodstype.Items.Clear();
foreach (DataRow dr in dt_goodsname.Rows)
{
string id = dr["goodstype2_id"].ToString(); //商品类别id
string title = dr["GOODSTYPE2NAME"].ToString(); //商品类别名称
this.cb_goodstype.Items.Add(title, id); //商品类别绑定
}
DataTable dt_stockname = new DataTable();
dt_stockname = stockbll.GetList_stockname(_peoid).Tables[0]; //获取仓库名称
this.cb_stock.Items.Clear();
foreach (DataRow dr in dt_stockname.Rows)
{
string stock_id = dr["GENSTORAGEID"].ToString(); // 仓库id
string stock_title = dr["GENSTORAGENAME"].ToString(); //仓库名称
this.cb_stock.Items.Add(stock_title, stock_id); //仓库名称绑定
}
this.cb_stock.DataBind();
this.cb_goodstype.DataBind();
}
#endregion