-
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using FrameWork;
- using FrameWork.Components;
- using FrameWork.WebControls;
- using System.Collections.Generic;
- namespace FrameWork.web.Manager.Module.AOAS.News.Article
- {
- public partial class Manager : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- OnStart();
- }
- }
- /// <summary>
- /// 开始操作
- /// </summary>
- private void OnStart()
- {
- BindClassList(0, "");
- }
- /// <summary>
- /// 分类内容绑定
- /// </summary>
- private void BindClassList(int PID, string Blank)
- {
- //通过PID获得相应信息
- QueryParam qp = new QueryParam();
- qp.Where = string.Format(" WHERE iParentID = '{0}'", PID);
- qp.Orderfld = " iParentID, iRootID";
- qp.OrderType = 0;
- int RecordCount = 0;
- List<tArticleClassEntity> lst = BusinessFacade.tArticleClassList(qp, out RecordCount);
- if (PID != 0)
- {
- Blank += " ";
- }
- foreach (tArticleClassEntity var in lst)
- {
- ListItem li = new ListItem();
- li.Text = Blank + var.cClassName;
- li.Value = var.iID.ToString();
- ClassID_Input.Items.Add(li);
- BindClassList(var.iID, Blank);
- }
- }
- }
- }
- <head>
- <title>DropDownList控件下的无限级分类(递归)</title>
- </head>
- <tr>
- <td>
- <td>
- <asp:DropDownList ID="ClassID_Input" runat="server">
- </asp:DropDownList>
- </td>
- </td>
- </tr>
- <body>
- </body>
- </html>
DropDownList控件下的无限级分类(递归)
最新推荐文章于 2016-12-29 15:37:00 发布