⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 left.aspx.cs

📁 网站后台管理系统框架 很精美的程序,大家可以自己修改
💻 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>";

                }

            }

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -