myblog is sunlight

 

vbz做的管理后台代码

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Left.aspx.vb" Inherits="Left" %>
<html>
<head runat="server" >
<link type="text/css" href="CSS/default.css" />

    <title></title>
    <script type="text/javascript" >
        function divshow(num) {
            if (document.getElementById(num).style.display == 'block') {
                document.getElementById(num).style.display = 'none'
            }
            else {
                document.getElementById(num).style.display = 'block'
            }
        }
    </script>
    <style  type ="text/css" >
        .menuGroup
        {
            cursor:hand;
            background-image:url(Images/title_gb.gif);
            margin-top :2px;
            margin-left:2px;
            margin-right:2px;
            height:25px;
            text-align: center;
            line-height:25px;
            font-weight:bold;
            color:White;
        }
        .YC
        {
            display :none ;
        }
        .XS
        {
            display :block ;
        }
        ul
        {
           margin-top:8px;
           margin-bottom:8px;
           padding-left:15px;
        }
        li
        {
           margin-top:5px;
           margin-bottom:5px;
           list-style-image:url(Images/xinx16.gif);
        }
body
{
    font-size:12px;
    overflow:auto;
}
A:link
{
 color: #003366;
 text-decoration: none;
}
A:visited
{
 color: #003366;
 text-decoration: none;
}
A:hover
{
 color: red;
 text-decoration: none;
}
    </style>
</head>
<body style="font-size :12px; margin:0px;">
 <form  id="form1" runat="server" method="post">
  <%=strMenu%>
 </form>
 
</body>
</html>

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dt As New DataTable
        dt = Menus.getMenu(Session("UserID"))
        Dim dv As New DataView(dt, "ParentID = 0", "MenuID", DataViewRowState.CurrentRows)
        Dim dvi As New DataView(dt)
        Dim i, j As Integer
        If dt.Rows.Count = 0 Then
            Response.Write("<script>alert('没有权限,请与管理员联系。');history.back();<" & "/script>")
        Else

            For j = 0 To dv.Count - 1
                dvi.RowFilter = "ParentID=" & dv(j)("MenuID")
                If dvi.Count > 0 Then
                    strMenu &= "<div onclick=divshow('" & j & "') class='menuGroup'>" & dv(j)("MenuText") & "</div>"
                    strMenu &= "<div id=" & j & " class='YC'><ul>"
                    For i = 0 To dvi.Count - 1
                        strMenu &= "<li><a href='" & dvi(i)("MenuURL") & "' target='mainFrame'>" & dvi(i)("MenuText") & "</a></li>"
                    Next
                    strMenu &= "</ul></div>"
                End If
            Next
        End If
    End Sub
End Class

posted on 2009-11-02 15:44  boboisboy  阅读(342)  评论(2编辑  收藏  举报

导航