初始化的时候:
ddlpmzcName.DataSource = new DTcms.BLL.auction().GetpmzcName();
ddlpmzcName.DataTextField = "title";
ddlpmzcName.DataValueField = "id";
ddlpmzcName.DataBind();
注:ddlpmzcName是控件的ID
修改初始化的时候的绑定是:
BLL.production bll = new BLL.production();
Model.production model = bll.GetModel(_id);
ddlCategoryId.SelectedValue = model.category_id.ToString();
ddlpmzcName.DataSource = new DTcms.BLL.auction().GetpmzcName();
ddlpmzcName.DataTextField = "title";
ddlpmzcName.DataValueField = "id";
ddlpmzcName.DataBind();
if (!string.IsNullOrEmpty(model.pmzc))
{
ddlpmzcName.SelectedValue = model.pmzc.ToString();
}