mmenu中的总菜单级别是多少?我需要5级

时间:2015-02-27 15:05:55

标签: html css asp.net mmenu

我正在使用mmenu(http://mmenu.frebsite.nl/)。我需要向下钻取至少4个级别,可能是5.菜单将向下钻取的级别是否有限制?如果是这样,我怎样才能达到至少四个级别的向下钻取? 在此先感谢您的帮助!

     Private Sub RenderMSRows()

            Dim ReportName As String
            Dim ReportNamesub As String
            Dim ReportCategory As String
            Dim ReportCategorySub As String
            Dim ReportCategoryYear As String
            Dim ReportNameYear As String

            Dim HTMLString As String = ""
            Dim ulString As String = "<ul data-role=" & Chr(34) & "listview" & Chr(34) & ">" & vbCrLf



            'Get the Main Category

            HTMLString = HTMLString & ulString
            For Each mc In _ReportMasters
                ReportName = mc.Report_Name

                HTMLString = HTMLString & "<li>" & vbCrLf
                HTMLString = HTMLString & "<span title='" & ReportName & "'>" & ReportName & "</span>" & vbCrLf


                'Get the Sub Category List

                HTMLString = HTMLString & "<ul>" & vbCrLf
                HTMLString = HTMLString & "<li>" & vbCrLf

                For Each sc In _ReportDetails
                    ReportNamesub = sc.Report_Name
                    ReportCategory = sc.Report_Category

                    If ReportNamesub = ReportName  Then
                        HTMLString = HTMLString & "<a href='' title='" & ReportName & "'>" & ReportCategory & "</a>" & vbCrLf
                    End If
***from here is where it will lock up if I don't quote it out***
                    'Get the Year List

                    HTMLString = HTMLString & "<ul>" & vbCrLf
                    HTMLString = HTMLString & "<li>" & vbCrLf

                    For Each y In _ReportCategoryandYears
                        ReportNameYear = y.Report_Name
                        ReportCategoryYear = y.Report_Year
                        ReportCategorySub = y.Report_Category
                        If ReportCategorySub = ReportCategory And ReportNameYear = ReportName Then
                            HTMLString = HTMLString & "<a href='' title='" & ReportCategoryYear & "'>" & ReportCategoryYear & "</a>" & vbCrLf
                        End If
                    Next
                    HTMLString = HTMLString & "</li>" & vbCrLf
                    HTMLString = HTMLString & "</ul>" & vbCrLf
 ***to here***   
                Next
                HTMLString = HTMLString & "</li>" & vbCrLf
                HTMLString = HTMLString & "</ul>" & vbCrLf
                HTMLString = HTMLString & "</li>" & vbCrLf

            Next

            HTMLString = HTMLString & "</ul>"
            Me.MenuBar.Text = HTMLString

        End Sub

1 个答案:

答案 0 :(得分:0)

以下是向下钻取5个等级的工作代码。我发现UL和LI元素需要按正确的顺序放置。

Dim ReportNameSub As String             Dim ReportCategorySub As String             Dim ReportOrderSub As String

        Dim ReportNameYear As String
        Dim ReportCategoryYear As String
        Dim ReportOrderYear As String
        Dim ReportYear As String

        Dim ReportNameMonth As String
        Dim ReportCategoryMonth As String
        Dim ReportOrderMonth As String
        Dim ReportYearMonth As String
        Dim ReportMonth As String

        Dim ReportNameLocation As String
        Dim ReportCategoryLocation As String
        Dim ReportOrderLocation As String
        Dim ReportYearLocation As String
        Dim ReportMonthLocation As String
        Dim ReportSubNameLocation As String
        Dim ReportLocation As String

        Dim HTMLString As String = ""
        Dim ulString As String = "<ul data-role=" & Chr(34) & "listview" & Chr(34) & ">" & vbCrLf

        'Get the Main Category

        HTMLString = HTMLString & ulString

        For Each mc In _ReportMasterSorteds
            ReportName = mc.report_name
            ReportOrder = mc.Report_Order

            If ReportName <> "" Then
                HTMLString = HTMLString & "<li>" & vbCrLf
                HTMLString = HTMLString & "<span title='" & ReportName & "'>" & ReportName & "</span>" & vbCrLf

                'Get the Sub Category List
                HTMLString = HTMLString & "<ul>" & vbCrLf

                For Each sc In _ReportDetails
                    ReportNameSub = sc.Report_Name
                    ReportCategorySub = sc.Report_Category
                    ReportOrderSub = sc.Report_Order

                    If ReportOrderSub = ReportOrder And ReportNameSub = ReportName Then
                        HTMLString = HTMLString & "<li>" & vbCrLf
                        HTMLString = HTMLString & "<span title='" & ReportName & "'>" & ReportCategorySub & "</span>" & vbCrLf

                        ' Get the Year List
                        HTMLString = HTMLString & "<ul>" & vbCrLf

                        For Each y In _ReportCategoryandYears
                            ReportNameYear = y.Report_Name
                            ReportCategoryYear = y.Report_Category
                            ReportOrderYear = y.Report_Order
                            ReportYear = y.Report_Year

                            If ReportOrderYear = ReportOrderSub And ReportNameYear = ReportNameSub And ReportCategoryYear = ReportCategorySub Then
                                HTMLString = HTMLString & "<li>" & vbCrLf
                                HTMLString = HTMLString & "<span title='" & ReportCategoryYear & "'>" & ReportYear & "</span>" & vbCrLf

                                ' Get the Month List
                                HTMLString = HTMLString & "<ul>" & vbCrLf

                                For Each m In _ReportDetailMonths
                                    ReportNameMonth = m.Report_Name
                                    ReportCategoryMonth = m.Report_Category
                                    ReportOrderMonth = m.Report_Order
                                    ReportYearMonth = m.Report_Year
                                    ReportMonth = m.Report_Frequency

                                    If ReportOrderMonth = ReportOrderYear And ReportNameMonth = ReportNameYear And ReportCategoryMonth = ReportCategoryYear And ReportYearMonth = ReportYear Then
                                        HTMLString = HTMLString & "<li>" & vbCrLf
                                        HTMLString = HTMLString & "<span title='" & ReportYear & "'>" & ReportMonth & "</span>" & vbCrLf


                                        ' Get the Name and Location List
                                        HTMLString = HTMLString & "<ul>" & vbCrLf

                                        For Each l In _ReportDetailReportandLocations
                                            ReportNameLocation = l.Report_Name
                                            ReportCategoryLocation = l.Report_Category
                                            ReportOrderLocation = l.Report_Order
                                            ReportYearLocation = l.Report_Year
                                            ReportMonthLocation = l.Report_Frequency
                                            ReportSubNameLocation = l.Sub_Report_Name
                                            ReportLocation = l.Report_Location

                                            If ReportOrderLocation = ReportOrderMonth And ReportNameLocation = ReportNameMonth And ReportCategoryLocation = ReportCategoryMonth And ReportYearLocation = ReportYearMonth And ReportMonthLocation = ReportMonth Then
                                                HTMLString = HTMLString & "<li>" & vbCrLf
                                                HTMLString = HTMLString & "<a href=''  title='" & ReportMonth & "'>" & ReportSubNameLocation & "</a>" & vbCrLf
                                                HTMLString = HTMLString & "</li>" & vbCrLf
                                            End If

                                        Next
                                        'end of Name and Location list
                                        HTMLString = HTMLString & "</ul>" & vbCrLf
                                        HTMLString = HTMLString & "</li>" & vbCrLf
                                    End If

                                Next
                                'end of Month list
                                HTMLString = HTMLString & "</ul>" & vbCrLf
                                HTMLString = HTMLString & "</li>" & vbCrLf
                            End If

                        Next
                        end of year list

                        HTMLString = HTMLString & "</ul>" & vbCrLf
                        HTMLString = HTMLString & "</li>" & vbCrLf
                    End If

                Next
                'End of subcat list

                HTMLString = HTMLString & "</ul>" & vbCrLf
                HTMLString = HTMLString & "</li>" & vbCrLf
            End If
        Next
        'end of cat list

        HTMLString = HTMLString & "</ul>"

        Me.menubar.Text = HTMLString