asp.net下拉列表的填充的后台编写

asp.net后台下拉列表的填充

 

 1         protected void Page_Load(object sender, EventArgs e)
 2         {
 3             if (!IsPostBack)
 4             {
 5                 //初始化菜品下拉框
 6                 this.ddlCategory.DataValueField = "CategoryId";
 7                 this.ddlCategory.DataTextField = "CategoryName";
 8                 this.ddlCategory.DataSource = new DAL.DishService().GetAllCategory();
 9                 this.ddlCategory.DataBind();
10             }
11         }  

 

posted @ 2017-12-28 17:25  爱踢两键  阅读(202)  评论(0编辑  收藏  举报