示例#1
0
        private void TreeBind()
        {
            BLL.meal_category bll = new BLL.meal_category();
            DataTable         dt  = bll.GetList(0);

            this.ddlParentId.Items.Clear();
            this.ddlParentId.Items.Add(new ListItem("无父级分类", "0"));
            foreach (DataRow dr in dt.Rows)
            {
                string Id         = dr["id"].ToString();
                int    ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title      = dr["title"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlParentId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlParentId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
示例#2
0
        //数据绑定
        private void RptBind()
        {
            BLL.meal_category bll = new BLL.meal_category();
            DataTable         dt  = bll.GetList(0);

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
示例#3
0
        private void TreeBind()
        {
            BLL.meal_category bll = new BLL.meal_category();
            DataTable dt = bll.GetList(0);

            this.ddlCategoryId.Items.Clear();
            this.ddlCategoryId.Items.Add(new ListItem("所有类别", ""));
            foreach (DataRow dr in dt.Rows)
            {
                string Id = dr["id"].ToString();
                int ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title = dr["title"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlCategoryId.Items.Add(new ListItem(Title, Id));
                }
            }
        }
示例#4
0
 //数据绑定
 private void RptBind()
 {
     BLL.meal_category bll = new BLL.meal_category();
     DataTable dt = bll.GetList(0);
     this.rptList.DataSource = dt;
     this.rptList.DataBind();
 }