Response document is being truncated

Posted on 2007-08-07
Last Modified: 2012-05-05
First Question ever posted on here.!!!
I am developing an a home page in  I am using the obout EasyMenu control for the menu of the whole site.  It is actually in a masterpage (which may be part of the problem).  What I am seeing is that when I add too much code (it doesn't matter whether its comments or code) to the child page, some of the code that is generated from the EasyMenu control begins to be truncated.  The more code I add, the more that gets truncated, until all the sub items are gone.

The sub-menu items are actually added after the  </HTML> tag.  When I save the page source file, it seems to be about 30 kb.
Question by:smcdrc
    LVL 38

    Expert Comment

    Check the markup code for the master page.  Make sure that the content place holder is not embedded in the menu tag.  You might consider pasting the markup for your master page if it's not very lengthy.
    LVL 38

    Expert Comment

    pasting the markup = posting the markup
    LVL 2

    Author Comment

    Here is the .master page.

    <%@ Master Language="VB" CodeFile="MainPage.master.vb" Inherits="MainPage" %>
    <%@ Register Assembly="obout_EasyMenu_Pro" Namespace="OboutInc.EasyMenu_Pro" TagPrefix="oem" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

    <html xmlns="" >
    <head runat="server">
        <title>Wolverine Pipe Line Company</title>
        <link href="../styles/wpl.css" rel="stylesheet" type="text/css" />
    <body topmargin="0" leftmargin="0">
        <form id="form1" runat="server">
            <table border="0" cellpadding="0" cellspacing="0">
                <img alt="Wolverine Pipe Line Company" src="../images/HeaderLogo.jpg" /></td></tr>
                        <asp:PlaceHolder ID="ph1" runat="server"></asp:PlaceHolder>
                    <td> <asp:contentplaceholder id="MainBody" runat="server">
                    <!--Footer area -->
            <br />
    LVL 2

    Author Comment

    Here is the master.vb file:

    Imports WPLData
    Imports System.Configuration.ConfigurationSettings
    Imports System.Data
    Imports OboutInc.EasyMenu_Pro
    Imports OboutInc

    Partial Class MainPage
        Inherits System.Web.UI.MasterPage 'OboutInc.oboutAJAXMasterPage '

        Dim mydata As WplData
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        End Sub
        Private Sub CreateEasyMenu()
            Dim dtMenu As DataTable

            Dim StyleFolder As String = ""
            Dim IconsFolder As String = ""

            mydata = New WplData("Server=WOLV-DB1;integrated security=SSPI;database=WPLCO;trusted_connection=Yes;") 'WplData(ConfigurationManager.ConnectionStrings("WPLCOconnection").ConnectionString)
            mydata.SetParameterValue("@MenuID", 1)
            dtMenu = mydata.ExecInstatiatedStoredProc()

            '/*** main menu - records with ParentId = 0 ***/
            Dim mainEM As EasyMenu = Nothing
            '/*** ***/

            '/*** list with child menus ***/
            Dim childMenus As Hashtable = Nothing
            For Each row As DataRow In dtMenu.Rows
                ' While oReader.Read()
                Dim Id As Int32 = Int32.Parse(row("ID"))
                Dim parentId As Int32 = Int32.Parse(row("ParentID"))
                Dim InnerHtml As String = row("InnerHtml").ToString().Trim()
                Dim HtmlLink As String
                If row("HtmlLink") Is Nothing Then
                    HtmlLink = ""
                    HtmlLink = row("HtmlLink").ToString().Trim()
                End If
                Dim level As Int32 = Int32.Parse(row("Level"))
                Dim icon As String
                If row("Icon") Is Nothing Then
                    icon = ""
                    icon = row("Icon").ToString().Trim()
                End If

                If (parentId = 0) Then

                    If (mainEM Is Nothing) Then

                        mainEM = New EasyMenu() '
                        mainEM.ID = "mainEM" '
                        mainEM.Width = "781" '
                        mainEM.ShowEvent = MenuShowEvent.Always '
                        mainEM.StyleFolder = StyleFolder
                        mainEM.IconsFolder = IconsFolder
                        mainEM.IconsPosition = MenuIconsPosition.Left
                        mainEM.UseIcons = True
                        mainEM.Position = MenuPosition.Horizontal
                        ' mainEM.Position = MenuPosition.Vertical ''For Vertical alignment

                        '// css classes names for the menu and the item container
                        mainEM.CSSMenu = "ParentMenu" '
                        mainEM.Align = MenuAlign.Right
                        mainEM.CSSMenuItemContainer = "ParentItemContainer" '

                        '// css classes names for MenuItems
                        Dim MenuItemCssClasses As CSSClasses = mainEM.CSSClassesCollection(mainEM.CSSClassesCollection.Add(New CSSClasses(GetType(OboutInc.EasyMenu_Pro.MenuItem)))) '
                        MenuItemCssClasses.ComponentSubMenuCellOver = "ParentItemSubMenuCellOver"
                        MenuItemCssClasses.ComponentContentCell = "ParentItemContentCell" '
                        MenuItemCssClasses.Component = "ParentItem" '
                        MenuItemCssClasses.ComponentSubMenuCell = "ParentItemSubMenuCell" '
                        MenuItemCssClasses.ComponentIconCellOver = "ParentItemIconCellOver" '
                        MenuItemCssClasses.ComponentIconCell = "ParentItemIconCell" '
                        MenuItemCssClasses.ComponentOver = "ParentItemOver" '
                        MenuItemCssClasses.ComponentContentCellOver = "ParentItemContentCellOver" '
                        '// add the classes names to the collection
                        mainEM.CSSClassesCollection.Add(MenuItemCssClasses) '

                        '// css classes names for MenuSeparators
                        Dim MenuSeparatorCssClasses As CSSClasses = mainEM.CSSClassesCollection(mainEM.CSSClassesCollection.Add(New CSSClasses(GetType(MenuSeparator))))
                        MenuSeparatorCssClasses.ComponentSubMenuCellOver = "ParentSeparatorSubMenuCellOver" '
                        MenuSeparatorCssClasses.ComponentContentCell = "ParentSeparatorContentCell" '
                        MenuSeparatorCssClasses.Component = "ParentSeparator" '
                        MenuSeparatorCssClasses.ComponentSubMenuCell = "ParentSeparatorSubMenuCell" '
                        MenuSeparatorCssClasses.ComponentIconCellOver = "ParentSeparatorIconCellOver" '
                        MenuSeparatorCssClasses.ComponentIconCell = "ParentSeparatorIconCell" '
                        MenuSeparatorCssClasses.ComponentOver = "ParentSeparatorOver" '
                        MenuSeparatorCssClasses.ComponentContentCellOver = "ParentSeparatorContentCellOver" '
                        '// add the classes names to the collection
                        mainEM.CSSClassesCollection.Add(MenuSeparatorCssClasses) '
                    End If

                    mainEM.AddItem(New OboutInc.EasyMenu_Pro.MenuItem("item_" + Id.ToString(), InnerHtml.Trim(), icon, HtmlLink, "", "")) '



                    If (childMenus Is Nothing) Then
                        childMenus = New Hashtable() '
                    End If
                    '/* first time the menu is ceated */
                    If Not (childMenus.ContainsKey(parentId)) Then

                        Dim childEM As EasyMenu = New EasyMenu()
                        childEM.ID = "childEM_" + parentId.ToString() '
                        childEM.StyleFolder = StyleFolder
                        childEM.IconsFolder = IconsFolder
                        childEM.UseIcons = True
                        childEM.IconsPosition = MenuIconsPosition.Right

                        childEM.ShowEvent = MenuShowEvent.MouseOver '
                        childEM.AttachTo = "item_" + parentId.ToString() '
                        childEM.Width = "150" '
                        'childEM.Align = MenuAlign.Right ''For Vertical alignment
                        childEM.Align = MenuAlign.Under
                        Dim menuLevel As Int32 = level
                        If (menuLevel = 1) Then
                            childEM.Align = MenuAlign.Under
                            childEM.Align = MenuAlign.Left
                        End If

                        childEM.AddItem(New OboutInc.EasyMenu_Pro.MenuItem("item_" + Id.ToString(), InnerHtml, icon, HtmlLink, "", "")) '

                        childMenus.Add(parentId, childEM) '

                        Me.Controls.Add(childEM) '

                        '/* items are added to the already created menu */

                        'Dim childEM As EasyMenu = New EasyMenu() '(EasyMenu)childMenus[parentId];
                        Dim childEM As EasyMenu = childMenus(parentId)
                        childEM.Align = MenuAlign.Under ''For Vertical alignment
                        childEM.AddItem(New OboutInc.EasyMenu_Pro.MenuItem("item_" + Id.ToString(), InnerHtml, icon, HtmlLink, "", "")) '
                    End If
                End If
                'End While
            'oReader.Close() '
            'Cn.Close() '

        End Sub
    End Class
    LVL 38

    Expert Comment

    >Me.Controls.Add(childEM) '

    You appear to be adding the child menu items to the master page without inserting them into the correct place.  Do they not belong in the master menu?

    LVL 2

    Author Comment

    This works just fine, if the child page has less code in it.  Is something I can change about response size?  
    LVL 38

    Accepted Solution

    If your page is well formed, then really the size shouldn't make a difference.  The thing is that something is causing your application to render invalid HTML.  If stuff from the menu is getting rendered after the closing HTML tag, then I tend to suspect the master page rendering...

    Does your page have any problems if you comment out this line?

    Me.Controls.Add(childEM) '
    LVL 2

    Author Comment

    I thought about what you said.  Me, I am guessing, was referring to the page.  You need to add the controls to page, somewhere.  So I changed

    Me.Controls.Add(childEM) '



    LVL 38

    Expert Comment

    Yes, the Me keyword refers to the instance of the class that it is within.  In this case the master page.

    Glad you got it sorted.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    Running classic asp applications under Windows Server 2008 R2 (x64) and IIS 7 is not as easy as one may think. It took me a while to figure it out while getting error 8002801d a few times. After you install the OS you will need to install the fol…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now