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

首頁(yè) > 編程 > .NET > 正文

asp.net 2.0 中遞歸樹(shù)的實(shí)現(xiàn)

2024-07-10 13:06:08
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
  • 網(wǎng)站運(yùn)營(yíng)seo文章大全
  • 提供全面的站長(zhǎng)運(yùn)營(yíng)經(jīng)驗(yàn)及seo技術(shù)!
  • html頁(yè)面:

     

    --------------------------------------------------------------------------------


    <%[email protected] page language="vb" autoeventwireup="false" codefile="treeview.aspx.vb" inherits="treeview" %>

    <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>無(wú)標(biāo)題頁(yè)</title>
        <base target="main">
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:treeview id="treeview1" runat="server" expanddepth="1" font-size="9pt" autogeneratedatabindings="false" enabletheming="true" nodewrap="true" showlines="true" target="_blank">
            </asp:treeview>
       
        </div>
        </form>
    </body>
    </html>
     后臺(tái)cs代碼:

     

    --------------------------------------------------------------------------------


    imports system.web
    imports system.data.sqlclient
    imports system.data

    partial class treeviewclass treeview
        inherits system.web.ui.page

        dim ds as dataset = new system.data.dataset()


        protected sub page_load()sub page_load(byval sender as object, byval e as system.eventargs) handles me.load
            if not ispostback then
                dim sqlstr as string = "select a.*,t32003.t3200303 as orderprogramid from(select 項(xiàng)目代碼 as nodeid,項(xiàng)目名稱 as nodename,項(xiàng)目名稱 as parentid from acf_v_lefttree_admin where 項(xiàng)目代碼<>' ' and 項(xiàng)目代碼 is not null group by 項(xiàng)目代碼,項(xiàng)目名稱 union all select 系統(tǒng)代碼 as nodeid,系統(tǒng)名稱 as nodename,項(xiàng)目代碼 as parentid from acf_v_lefttree_admin where 系統(tǒng)代碼<>' ' and 系統(tǒng)代碼 is not null group by 項(xiàng)目代碼,系統(tǒng)代碼,系統(tǒng)名稱  union all select 子系統(tǒng)代碼 as nodeid,子系統(tǒng)名稱 as nodename,系統(tǒng)代碼 as parentid from acf_v_lefttree_admin where 子系統(tǒng)代碼<>' ' and 子系統(tǒng)代碼 is not null group by 系統(tǒng)代碼,子系統(tǒng)代碼,子系統(tǒng)名稱  union all select 程式代碼 as nodeid,程式名稱 as nodename,子系統(tǒng)代碼 as parentid from acf_v_lefttree_admin where  程式代碼<>' ' and 程式代碼 is not null group by 子系統(tǒng)代碼,程式代碼,程式名稱 ) a left outer join t32003 on a.nodeid = t32003.t3200301"
                dim conn as sqlconnection = new sqlconnection("server=(local);database=acfv3;uid=sa;pwd=888888")
                dim sqlada as sqldataadapter = new sqldataadapter(sqlstr, conn)
                sqlada.fill(ds, "treetb")
                createtree(treeview1.nodes, "我的acf")

            end if
        end sub

        private sub createtree()sub createtree(byval treevwnds as treenodecollection, byval strcurrentid as string)
            dim datviw as new dataview
            dim datrow as datarowview
            dim treevwnode as treenode
            dim currentid as string
            datviw.table = ds.tables("treetb")
            datviw.sort = "orderprogramid"
            try
                datviw.rowfilter = " parentid ='" & strcurrentid & "'"
                if datviw.count > 0 then
                    for each datrow in datviw
                        treevwnode = new treenode
                        treevwnode.value = datrow("nodeid")
                        currentid = datrow("nodeid")
                        treevwnds.add(treevwnode)
                        treevwnode.text = trim(datrow("nodename"))
                        treevwnode.target = "_blank"
                        dim i as integer = treevwnds.count
                        createtree(treevwnds(treevwnds.count - 1).childnodes, currentid)
                    next
                end if
            catch ex as exception
                response.write(ex.tostring)

            end try

        end sub
    end class

    發(fā)表評(píng)論 共有條評(píng)論
    用戶名: 密碼:
    驗(yàn)證碼: 匿名發(fā)表
    主站蜘蛛池模板: 晋州市| 湄潭县| 留坝县| 安徽省| 恩施市| 丹巴县| 贵溪市| 罗源县| 九江县| 辽阳市| 张家口市| 新竹市| 安多县| 麻江县| 灌南县| 唐河县| 陇西县| 城固县| 米易县| 永顺县| 威海市| 越西县| 会同县| 沂南县| 嘉峪关市| 岐山县| 满洲里市| 沁阳市| 开阳县| 九寨沟县| 疏附县| 搜索| 额尔古纳市| 额敏县| 巍山| 巴塘县| 托里县| 观塘区| 常熟市| 平昌县| 禄劝|