⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 productcategorieslist.ascx.cs

📁 易想商城系统
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Text;

namespace YXShop.Web.Admin.Product.Control
{
    public partial class ProductCategoriesList : System.Web.UI.UserControl
    {
        protected string SelectList;
        private string strProID = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            SelectContent();
        }
        public string StrProID
        {
            get
            {
                return (strProID == null) ? "" : strProID;
            }
            set { strProID = value; }
        }
        protected void SelectContent()
        {
            YXShop.BLL.Pro_Brand dataB = new YXShop.BLL.Pro_Brand();
            YXShop.BLL.Pro_Categories data = new YXShop.BLL.Pro_Categories();
            List<YXShop.Model.Pro_Categories> Ldata = data.GetAll();
            StringBuilder shtml = new StringBuilder();
            shtml.Append("<select id=\"ProductCategories\" name=\"ProductCategories\" size=\"8\" multiple width=\"400px\">");
            if (Ldata.Count > 0)
            {

                int j = 0;
                foreach (YXShop.Model.Pro_Categories ds in Ldata)
                {
                    string[] Path = ds.ProC_ParentPath.ToString().Split(',');
                    string KG = "";
                    for (int i = 1; i < Path.Length; i++)
                    {
                        KG += "&nbsp;&nbsp;";
                    }
                    if (StrProID != string.Empty)
                    {
                        //修改品牌信息时判断产品分类是否选中
                        string[] ParentPath = StrProID.Split(',');
                        
                        if (j < ParentPath.Length && ParentPath[j].ToString() == ds.ProC_ID.ToString())
                        {

                            shtml.Append("<option value=" + ds.ProC_ID + " selected>" + KG + "├" + ds.ProC_CategroiesName + "</option>");
                            j++;
                        }
                        else
                        {
                            shtml.Append("<option value=" + ds.ProC_ID + " >" + KG + "├" + ds.ProC_CategroiesName + "</option>");
                        }
                    }
                    else
                    {
                        shtml.Append("<option value=" + ds.ProC_ID + " >" + KG + "├" + ds.ProC_CategroiesName + "</option>");
                    }
                }
            }
            shtml.Append("</select>");
            SelectList = shtml.ToString();
        }


    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -