点击回首页
我的浏览记录 | | 帮助?
当前位置:
首页>> 尚未分类>> 网站后台管理系统框架源码>> 源文件浏览
[免费版 Free] WebForm,下载次数:9883 次 | 关键字: C#入门 后台管理 框架 菜单

源码截图

源码目录树

当前路径:Manage/left.aspx.cs     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 System.Data.OleDb;
//该源码首发自www.51aspx.com(51aspx.com)

public partial class _Default : System.Web.UI.Page
{
    public string htmlr = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        ptberu();
    }
    private void ptberu()
    {
        htmlr="<TABLE height='100%' width='97%' border=0 cellspacing=0 cellpadding=0 align='left' class='menubar'><TR><TD valign=top>";
        string sqlstr = "select * from Menu where ParentID=0";
        OleDbConnection con = OleHelp.OpenConn();
        OleDbDataAdapter da = new OleDbDataAdapter(sqlstr, con);
        DataSet TreeTable = new DataSet();
        da.Fill(TreeTable);
        for (int i = 0; i < TreeTable.Tables[0].Rows.Count; i++)//循环判断首节点
        {
            htmlr += "<div class='clsPart'>";
            string bigClass = TreeTable.Tables[0].Rows[i]["MenuName"].ToString();
            if (TreeTable.Tables[0].Rows[i]["ParentID"].ToString() != "")
            {
                int MenuID = Convert.ToInt32(TreeTable.Tables[0].Rows[i]["MenuID"].ToString());
                htmlr +="<TABLE height='25' width='100%' border='0' cellspacing='0' cellpadding='0' align='center'><TR height='25'><TD class='bartitle' align='center'>"+bigClass + "</TD></TR></TABLE>";
                sonPhtion(MenuID);
                
            }
            htmlr += "</div>";
            

        }
        htmlr += "</TD></TR></TABLE>";

    }
    private void sonPhtion(int ParentID)
    {
        string sontab = "select * from Menu where ParentID=" + ParentID;
        OleDbConnection con = OleHelp.OpenConn();
        OleDbDataAdapter da = new OleDbDataAdapter(sontab, con);
        DataSet TreeTable = new DataSet();
        da.Fill(TreeTable);
        DataTable tabson = TreeTable.Tables[0];
        if (tabson.Rows.Count > 0)
        {
            htmlr += "<div id='bar0content' class='barcontent'>";
            //htmlr += "<TR class='clstrc'><TD bgcolor='#D6DFF&'>&nbsp;</TD><TD class='datalist'>";
            for (int j = 0; j < tabson.Rows.Count; j++)//循环判断子节点
            {
                string smallName = tabson.Rows[j]["MenuName"].ToString();
                if (tabson.Rows[j]["ParentID"].ToString() != "")
                {
                    int samllNum = Convert.ToInt32(tabson.Rows[j]["MenuID"].ToString());
                    htmlr += "<TABLE width='100%' border=0 cellspacing=0 cellpadding=0><TR class='clstr'><TD width='35' height='30' align='center'><IMG SRC='images/Arrow1.gif' WIDTH='20' HEIGHT='20' BORDER=0 ALT=''></TD><TD onmouseover=\"this.style.backgroundColor='#D6DFF0'\" onmouseout=\"this.style.backgroundColor='#6E8ADE'\">&nbsp;" + smallName + "</TD></TR><TR class='clstrc'><TD></TD><TD class='datalist'>";
                    endPhtion(samllNum);
                    //***********************无限分类*********************//
                    //调用sonPhtion(samllNum);
                    htmlr += "</TD></TR></TABLE>";
                }

            }
            htmlr += "</div>";

        }
    }
    //***********************无限分类*********************//
    private void endPhtion(int ParentID)
    {
        OleDbConnection con = OleHelp.OpenConn();
        string sontab = "select * from Menu where ParentID=" + ParentID;
        OleDbDataAdapter da = new OleDbDataAdapter(sontab, con);
        DataSet TreeTable = new DataSet();
        da.Fill(TreeTable);
        DataTable tabson = TreeTable.Tables[0];
        if (tabson.Rows.Count > 0)
        {
            for (int j = 0; j < tabson.Rows.Count; j++)//循环判断子节点
            {
                string smallName = tabson.Rows[j]["MenuName"].ToString();
                if (tabson.Rows[j]["ParentID"].ToString() != "")
                {
                    int samllNum = Convert.ToInt32(tabson.Rows[j]["MenuID"].ToString());
                    string LinkUrl=tabson.Rows[j]["LinkUrl"].ToString();
                    htmlr += "<div class='clsdiv' onmouseover=\"this.style.backgroundColor='#D6DFF0';this.style.cursor='hand';\" onmouseout=\"this.style.backgroundColor='#6E8ADE'\"><IMG SRC=\"images/file.gif\"  BORDER=0 >&nbsp;&nbsp;<a herf='" + LinkUrl + "' target='tabWin'>" + smallName + "</a></div>";

                }

            }

        }
    }
}
关于我们 | 顾问团队 | 发展历程 | 联系我们 | 源码上传
联系电话(Tel):4008-010-151(免长途) 企业QQ:4000410510
地址:北京市海淀区中关村鼎好大厦A座二层 邮编:100080
Room A-801,Dinghao Building,Zhongguancun,Beijing,China,100080
51Aspx.com 版权所有 CopyRight © 2006-2015. 京ICP备09089570号 | 京公网安备11010702000869号
在线客服
分享该页面
关闭侧边栏