?
Solved

Remove extra white space in asp.net dynamic  menu

Posted on 2013-12-26
3
Medium Priority
?
1,267 Views
Last Modified: 2013-12-31
Dynamic menu appears correctly from a file named MenuTest.aspx. Dynamic menu items are separated by white spaced when the menu is rendered from Site.Master.

Rendered correctly:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MenuTest.aspx.cs"
     Inherits="StockProMax.MenuTest" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Main Menu Page </title>
</head>
<body>
    <form id="form1" runat="server">
        Main Menu Page
        <br />
    <div>
   
        <asp:Menu ID="Menu1" runat="server"
            Orientation="Horizontal"
            CssClass="Menu"
            RenderingMode="Table"
            DynamicMenuItemStyle-ItemSpacing="2px"
            DynamicMenuStyle-BackColor="White"
            DynamicHorizontalOffset="2"
            DynamicMenuItemStyle-BackColor="Yellow"
            DynamicMenuItemStyle-VerticalPadding="1px"
            DynamicMenuStyle-BorderStyle="Solid"
            DynamicMenuStyle-HorizontalPadding="1px"
            DynamicMenuStyle-VerticalPadding="1px"
            DynamicSelectedStyle-BackColor="Lime"
            DynamicVerticalOffset="1"  
            IncludeStyleBlock="False"
            MaximumDynamicDisplayLevels="2"
            DisappearAfter="-1"
            Height="16px" Width="100px">
           
            <Items>
            <asp:MenuItem NavigateUrl="#" Text="Basics" Value="mnuBasics">
                <asp:MenuItem
                    NavigateUrl="Default.aspx" Text="Home" Value="mnuHome" >
                </asp:MenuItem>
                   
                <asp:MenuItem
                    NavigateUrl="ContactUs.aspx" Text="Contact Us" Value="mnuContactUs">
                </asp:MenuItem>

            </asp:MenuItem>
                   
            <asp:MenuItem NavigateUrl="#" Text="Features" Value="mnuFeatures">
                <asp:MenuItem
                    NavigateUrl="BestPicks.aspx" Text="Best Picks(Registered Users)" Value="mnuBestPicks">
                </asp:MenuItem>
                   
                <asp:MenuItem
                    NavigateUrl="FinanceTermsDefn.aspx" Text="Finance Terms" Value="mnuFinanceTerms">
                </asp:MenuItem>
 
            </asp:MenuItem>
               
            <asp:MenuItem NavigateUrl="#" Text="Registration" Value="mnuRegistration">
                   
                <asp:MenuItem
                    NavigateUrl="RenewSubscription.aspx" Text="Renew Subscription" Value="mnuRenew">
                </asp:MenuItem>

                <asp:MenuItem
                    NavigateUrl="RegisterFree.aspx" Text="Free Trial" Value="mnuFreeTrial">
                </asp:MenuItem>
                   
                <asp:MenuItem
                    NavigateUrl="ReplacePassword.aspx" Text="Replace Password" Value="mnuReplacePassword">
                </asp:MenuItem>

                <asp:MenuItem
                    NavigateUrl="ChangePassword.aspx" Text="Change Password" Value="mnuChangePassword">
                </asp:MenuItem>
            </asp:MenuItem>
               
            <asp:MenuItem NavigateUrl="#" Text="Site Usage Help" Value="mnuSiteHelp">
                <asp:MenuItem
                    NavigateUrl="ChangePasswordInstructions.aspx" Text="Password Change Help" Value="mnuChangePasswordHelp">
                </asp:MenuItem>
            </asp:MenuItem>

            <asp:MenuItem NavigateUrl="#" Text="Admin Only" Value="mnuAdminOnly">
                <asp:MenuItem
                    NavigateUrl="Admin/AdminMenu.aspx" Text="Admin Menu" Value="mnuAdminMenu">
                </asp:MenuItem>
                   
            </asp:MenuItem>
                 
            </Items>
       
       </asp:Menu>

    </div>
    </form>
</body>
</html>

Site.Master Renders Extra White Space:

 <header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">
                    <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/StockProLogo.jpg" />
                </p>
            </div>
           
            <div>  
                <asp:Menu ID="Menu1" runat="server"
                    Orientation="Horizontal"
                    CssClass="Menu"
                    RenderingMode="Table"
                    DynamicMenuItemStyle-ItemSpacing="2px"
                    DynamicMenuStyle-BackColor="White"
                    DynamicHorizontalOffset="2"
                    DynamicMenuItemStyle-BackColor="Yellow"
                    DynamicMenuItemStyle-VerticalPadding="1px"
                    DynamicMenuStyle-BorderStyle="Solid"
                    DynamicMenuStyle-HorizontalPadding="1px"
                    DynamicMenuStyle-VerticalPadding="1px"
                    DynamicSelectedStyle-BackColor="Lime"
                    DynamicVerticalOffset="0"  
                    IncludeStyleBlock="False"
                    MaximumDynamicDisplayLevels="2"
                    DisappearAfter="-1"
                    Height="16px" Width="100px"
                    class="auto-style1" style="width: auto; height: 24px;
                    font-family: Arial, Helvetica, sans-serif;
                    font-size: 14px; font-weight: bold; font-style: normal;
                    font-variant: normal; color: #0000FF; background-color: #FFFF00;
                    text-align: center;">
               
                        <Items>
                            <asp:MenuItem NavigateUrl="#" Text="Basics" Value="mnuBasics">
                                <asp:MenuItem
                                    NavigateUrl="Default.aspx" Text="Home" Value="mnuHome" >
                                </asp:MenuItem>
                   
                                <asp:MenuItem
                                    NavigateUrl="ContactUs.aspx" Text="Contact Us" Value="mnuContactUs">
                                </asp:MenuItem>

                            </asp:MenuItem>
                   
                            <asp:MenuItem NavigateUrl="#" Text="Features" Value="mnuFeatures">
                                <asp:MenuItem
                                    NavigateUrl="BestPicks.aspx" Text="Best Picks(Registered Users)" Value="mnuBestPicks">
                                </asp:MenuItem>
                   
                                <asp:MenuItem
                                    NavigateUrl="FinanceTermsDefn.aspx" Text="Finance Terms" Value="mnuFinanceTerms">
                                </asp:MenuItem>
 
                            </asp:MenuItem>
               
                           <asp:MenuItem NavigateUrl="#" Text="Registration" Value="mnuRegistration">
                   
                                <asp:MenuItem
                                    NavigateUrl="RenewSubscription.aspx" Text="Renew Subscription" Value="mnuRenew">
                                </asp:MenuItem>

                                <asp:MenuItem
                                    NavigateUrl="RegisterFree.aspx" Text="Free Trial" Value="mnuFreeTrial">
                                </asp:MenuItem>
                   
                                <asp:MenuItem
                                    NavigateUrl="ReplacePassword.aspx" Text="Replace Password" Value="mnuReplacePassword">
                                </asp:MenuItem>

                                <asp:MenuItem
                                    NavigateUrl="ChangePassword.aspx" Text="Change Password" Value="mnuChangePassword">
                                </asp:MenuItem>
                            </asp:MenuItem>
               
                            <asp:MenuItem NavigateUrl="#" Text="Site Usage Help" Value="mnuSiteHelp">
                                <asp:MenuItem
                                    NavigateUrl="ChangePasswordInstructions.aspx" Text="Password Change Help" Value="mnuChangePasswordHelp">
                                </asp:MenuItem>
                            </asp:MenuItem>

                    <asp:MenuItem NavigateUrl="#" Text="Admin Only" Value="mnuAdminOnly">
                        <asp:MenuItem
                        NavigateUrl="Admin/AdminMenu.aspx" Text="Admin Menu" Value="mnuAdminMenu">
                        </asp:MenuItem>
              </asp:MenuItem>
             
             </Items>
         </asp:Menu>
        </div>

I cannot find any difference in the code.

Thanks,
MainMenu.jpg
MainMenuCorrect.jpg
0
Comment
Question by:Dovberman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 39740102
What if you comment out this line, or change the height:
"class="auto-style1" style="width: auto; height: 24px; "
0
 

Accepted Solution

by:
Dovberman earned 0 total points
ID: 39740165
I changed the rendering mode to List.

RenderingMode="List"

Now I need to separate the static items and increase the menu width.
Fix-item-seperation.jpg
0
 

Author Closing Comment

by:Dovberman
ID: 39747899
This was the only change that worked.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

771 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