📄 productcategories.ascx.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.Control
{
public partial class ProductCategories : System.Web.UI.UserControl
{
protected string SelectList,slingSelect1,OKID;
protected int i;
private string _id = string.Empty;
public string strID
{
get
{
return (_id == null) ? "" : _id;
}
set
{
_id = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
SelectContent();
}
protected void SelectContent()
{
YXShop.BLL.Pro_Categories bdata = new YXShop.BLL.Pro_Categories();
List<YXShop.Model.Pro_Categories> data =bdata.GetAll();
slingSelect1="<select id=\"ProductCategories\" name=\"ProductCategories\" runat=\"server\">";
if (strID != string.Empty&&strID!=null)
{
if (strID == "0")
{
slingSelect1 += "<option value=\"0\" selected>作为一级分类</option>";
}
}
else
{
slingSelect1 += "<option value=\"0\" >作为一级分类</option>";
}
if (data.Count > 0)
{
foreach (YXShop.Model.Pro_Categories ds in data)
{
string[] ParentPath = ds.ProC_ParentPath.Split(',');
string KG = "";
for (int j = 0; j < ParentPath.Length; j++)
{
KG += " ";
}
if (ds.ProC_ID.ToString() == strID)
{
slingSelect1 += "<option value=" + ds.ProC_ID + " selected >" + KG + "├" + ds.ProC_CategroiesName + "</option>";
}
else
{
slingSelect1 += "<option value=" + ds.ProC_ID + " >" + KG + "├" + ds.ProC_CategroiesName + "</option>";
}
}
}
slingSelect1+="</select>";
SelectList = slingSelect1.ToString();
}
//protected string Menu(int id)
//{
// YXShop.Bll.Pro_Categories bdata = new YXShop.Bll.Pro_Categories();
// List<YXShop.Model.Pro_Categories> data = bdata.GetListByColumn("ProC_FatherID", id);
// if (data.Count > 0)
// {
// foreach (YXShop.Model.Pro_Categories ds in data)
// {
// string[] ParentPath = ds.ProC_ParentPath.Split(',');
// string KG = " ";
// for (int j = 0; j < ParentPath.Length; j++)
// {
// KG += " ";
// }
// if (ds.ProC_ID.ToString() == OKID)
// {
// slingSelect1 += "<option value=" + ds.ProC_ID + " selected >├" + ds.ProC_CategroiesName + "</option>";
// }
// else
// {
// slingSelect1 += "<option value=" + ds.ProC_ID + " >" + KG + "├" + ds.ProC_CategroiesName + "</option>";
// }
// Menu(ds.ProC_ID);
// i++;
// }
// }
// return slingSelect1.ToString();
//}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -