国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

關于ASP.NET中TreeView用法的一個小例子

2024-07-10 12:44:15
字體:
來源:轉載
供稿:網友

代碼如下:
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.Data.SqlClient;
using Common;
using DataAccess;

public partial class Controls_ProductType2 : System.Web.UI.UserControl
{


    ProductType productType = new ProductType();
    Product product = new Product();

  protected void TreeView_TreeNodePopulate(object sender, TreeNodeEventArgs e)
    {

        if (e.Node.ChildNodes.Count == 0)
        {
            switch (e.Node.Depth)
            {
                case 0:
                    PopulateCategories(e.Node);
                    break;
                case 1:
                    PopulateProductType(e.Node);
                    break;
                case 2:
                    PopulateProducts(e.Node);
                    break;
            }
        }

      //  int i = TreeToXml.TreeToXML(TreeView1, "D:/TreeToXML.xml");

    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    //第一級節點(parentID=0)
    void PopulateCategories(TreeNode node)
    {
        DataTable dt = new DataTable();
        dt = productType.GetListByFatherNode();

        if (dt.Rows.Count > 0)
        {
            foreach (DataRow row in dt.Rows)
            {

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 刚察县| 海晏县| 古浪县| 库尔勒市| 信丰县| 郯城县| 克山县| 罗定市| 嘉义县| 怀柔区| 西乌珠穆沁旗| 乐亭县| 开鲁县| 潍坊市| 奉新县| 弋阳县| 浦东新区| 阜宁县| 长宁县| 天门市| 商丘市| 澄江县| 安福县| 开阳县| 张北县| 商城县| 尼木县| 泸水县| 建水县| 定西市| 大兴区| 蒲城县| 巫山县| 儋州市| 淳安县| 衡山县| 曲麻莱县| 南丹县| 宁陕县| 买车| 滦平县|