国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
    主站蜘蛛池模板: 墨江| 康乐县| 开阳县| 寿光市| 即墨市| 玛纳斯县| 舞钢市| 宜宾县| 乌拉特后旗| 乡宁县| 谢通门县| 青铜峡市| 东安县| 龙州县| 临城县| 页游| 黄平县| 翼城县| 德惠市| 白朗县| 克拉玛依市| 云阳县| 茶陵县| 星子县| 公安县| 视频| 同仁县| 福鼎市| 九龙城区| 诏安县| 洪泽县| 永平县| 桑日县| 当雄县| 苏尼特左旗| 独山县| 合作市| 清丰县| 肇州县| 柯坪县| 手游|