DropDownList控件下的无限级分类(递归)

    1. using System;
    2. using System.Data;
    3. using System.Configuration;
    4. using System.Collections;
    5. using System.Web;
    6. using System.Web.Security;
    7. using System.Web.UI;
    8. using System.Web.UI.WebControls;
    9. using System.Web.UI.WebControls.WebParts;
    10. using System.Web.UI.HtmlControls;
    11. using FrameWork;
    12. using FrameWork.Components;
    13. using FrameWork.WebControls;
    14. using System.Collections.Generic;
    15. namespace FrameWork.web.Manager.Module.AOAS.News.Article 
    16. {
    17.     public partial class Manager : System.Web.UI.Page
    18.     {
    19.         protected void Page_Load(object sender, EventArgs e)
    20.         {
    21.             if (!Page.IsPostBack)
    22.             {
    23.                 OnStart();
    24.             }
    25.         }
    26.         
    27.         /// <summary>
    28.         /// 开始操作
    29.         /// </summary>
    30.         private void OnStart()
    31.         {
    32.              BindClassList(0, "");
    33.         }
    34.         /// <summary>
    35.         /// 分类内容绑定
    36.         /// </summary>
    37.         private void BindClassList(int PID, string Blank)
    38.         {
    39.             //通过PID获得相应信息
    40.             QueryParam qp = new QueryParam();
    41.             qp.Where = string.Format(" WHERE iParentID = '{0}'", PID);
    42.             qp.Orderfld = " iParentID, iRootID";
    43.             qp.OrderType = 0;
    44.             int RecordCount = 0;
    45.             List<tArticleClassEntity> lst = BusinessFacade.tArticleClassList(qp, out RecordCount);
    46.             if (PID != 0)
    47.             {
    48.                 Blank += "  ";
    49.             }
    50.             foreach (tArticleClassEntity var in lst)
    51.             {
    52.                 ListItem li = new ListItem();
    53.                 li.Text = Blank + var.cClassName;
    54.                 li.Value = var.iID.ToString();
    55.                 ClassID_Input.Items.Add(li);
    56.                 BindClassList(var.iID, Blank);
    57.             }
    58.         }
    59.      }
    60. }
    <
    html>
  1. <head>
  2. <title>DropDownList控件下的无限级分类(递归)</title>
  3. </head>
  4.     <tr>
  5.         <td>
  6.             <td>
  7.                          <asp:DropDownList ID="ClassID_Input" runat="server">
  8.                          </asp:DropDownList>
  9.             </td>
  10.         </td>
  11.     </tr>
  12. <body>
  13. </body>
  14. </html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值