locked
Master Page Changed Menu now transaprent background RRS feed

  • Question

  • User1215529056 posted

    I had a site on an XP box for our intranet. Very basic.

    On the materpage I have this code for a small menu.

    When I moved it to Windows 7 Pro machine from XP the master page menu background became transparent.

    In debug in VS 2015 it looks good. I run dev on the actual server.

    I have images but not sure how to upload into this thread.

    I tested in Firefox, Chrome and IE and the new transparency is the same in all

    Any suggestions?

    Here's the code

    <asp:Menu ID="MasterMenu" runat="server" BackColor="#FFFBD6"
    DataSourceID="SiteMapDS" DynamicHorizontalOffset="2"
    Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" Height="19px"
    StaticSubMenuIndent="10px" StaticDisplayLevels="3" >
    <StaticSelectedStyle BackColor="#FFCC66" />
    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <DynamicHoverStyle BackColor="#990000" ForeColor="White" />
    <DynamicMenuStyle BackColor="#FFFBD6" />
    <DynamicSelectedStyle BackColor="#FFCC66" />
    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <StaticHoverStyle BackColor="#990000" ForeColor="White" BorderStyle="Solid" />
    </asp:Menu>

    Thursday, February 7, 2019 9:42 PM

Answers

  • User1215529056 posted

    Fixed. It was simple and suggested to me on another thread.

    I tried running your code and found that the background color can be set directly through the style property <StaticMenuItemStyle> of the Menu control.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 8, 2019 8:50 PM

All replies

  • User-1174608757 posted

    Hi RuthlessRoth,

    RuthlessRoth

    menu background

    According to your description, Could you please tell me the background mean? It means the static background of the whole  menu or the background of the options user selected? 

    Else , it seems the problem is caused by the type of windows machine , so  I suggest you to improve the level of IE Browser because if the level of browser may cause some compatibility issues.

    Best Regards

    Wei Zhang

    Friday, February 8, 2019 7:49 AM
  • User1215529056 posted

    background of menu and background of selection.

    When the host machine was XP and that version of .Net it worked fine even though it was developed on a Windows 7 pro machine

    The new host machine is Windows 7 pro. Now the menu and selection have changed.

    VS 2015 has been loaded on the Windows 7 host machine.

    If I run it in debug it works correctly and it used Firefox as the browser.

    If I access the site directly on the host machine or from a remote machine the odd behavior happens.

    It does not matter what browser I use. IE, Firefox or Chrome.

    Friday, February 8, 2019 2:59 PM
  • User475983607 posted

    Styles are applied by the browser not the the host.   If you moved the application to a new server then make sure you copied all the necessary CSS files and make sure the files references are still correct.   Open the browser's developer tools by pressing F12 and select the Network view.  Refresh the page and make sure there are no 404 (Not Found) errors. If you see 404 errors then you are missing files or the file reference is not correct.  

    The browser's dev tools also shows the styles applied to elements.  Right click an menu element and select "Inspect".   This will allow you to compare the working menu with the transparent menu. 

    Friday, February 8, 2019 3:19 PM
  • User1215529056 posted

    I saw this. Not sure what to do with it if anything.

    Does this indicate what the issue may be?

    XML Parsing Error: no root element found Location: http://localhost:50152/d40dca21ac9b40fa87f85ad7f7e3f970/browserLinkSignalR/send?transport=longPolling&connectionToken=AQAAANCMnd8BFdERjHoAwE%2FCl%2BsBAAAAA0G%2FqdBs5EWQwu5klGY4egAAAAACAAAAAAAQZgAAAAEAACAAAAAI77LuyhBHMlFJtmfFyLJiFZjMoWycPOD5s5lcUSkm%2FAAAAAAOgAAAAAIAACAAAADuFYCZvsnEkmXzdw5aZDS4Qntds0csb48eT101P6Q1YDAAAABMmBuaQBnuRubJfbaKf9j2PmZYKwgjHXCD8epf0%2BbQ%2Btp0RpghaCrEKvfaIAZRX5VAAAAAaIr92Ncommjfr8HGwCVFWZugiAw2B8j1owJ07pp%2FozA4yVEL6nwct1l7BlLPCsnevu%2BjW25nZId0diS16N%2FiEw%3D%3D&requestUrl=http%3A%2F%2F9ish%2F&browserName=Firefox&userAgent=Mozilla%2F5.0+(Windows+NT+6.1%3B+Win64%3B+x64%3B+rv%3A65.0)+Gecko%2F20100101+Firefox%2F65.0 Line Number 1, Column 1:

    Friday, February 8, 2019 8:19 PM
  • User-1174608757 posted

    Hi RuthlessRoth,

    The error shows clearly that the root element couldn't be found in xml file which is the data source of Menu control.You should write the xml file as below:

    <?xml version="1.0" encoding="utf-8" ?>
    <Menus>
        <Menu Url="~/Home.aspx" Text="Home" Value="Home Page" />
        <Menu Url="javascript:;" Text="Services" Value="Services Page">
            <SubMenu Url ="~/Consulting.aspx" Text="Consulting" Value="Consulting Page"></SubMenu>
            <SubMenu Url ="~/Outsourcing.aspx" Text="Outsourcing" Value="Outsourcing Page"></SubMenu>
        </Menu>
        <Menu Url="~/About.aspx" Text="About" Value="About Us Page" />
        <Menu Url="~/Contact.aspx" Text="Contact" Value="Contact Us Page" />
    </Menus>

    Here is the link how to use menu with xml file ,I hope it could help you:

    https://www.aspsnippets.com/Articles/ASPNet-Menu-XmlDataSource-Example-Populate-ASPNet-Menu-control-from-XML-file-using-C-and-VBNet.aspx

    Best Regards

    Wei Zhang

    Monday, February 11, 2019 1:30 AM
  • User1215529056 posted

    I have this code in the web.sitemap file. It does exist on the site root folder.

    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Default.aspx" title="Home" description="Home" >
    <siteMapNode url="http://10.0.0.231/wiki/projects" title="Neyenesch Wikis" description="9ish Wiki" />
    <siteMapNode url="Documents.aspx" title="Documents" description="9ish Documents" />
    <siteMapNode url="ISOProcedures.aspx" title="FSC Procedures" description="ISO/FSC Procedures" >
    <!--<siteMapNode url="CustomersShow.aspx" title="Customer List" description="Customer List" >-->
    <!--<siteMapNode url="CustomerAdd.aspx" title="Add Customer" description="Add Customer" />--></siteMapNode>

    <!--<siteMapNode url="ProspectsShow.aspx" title="Prospects" description="Prospects" >
    --><!--<siteMapNode url="ProspectAdd.aspx" title="Add Prospect" description="Add Prospect" />--><!--
    </siteMapNode>-->

    <siteMapNode url="VendorsShow.aspx" title="Vendors" description="Vendors" >
    <siteMapNode url="VendorAdd.aspx" title="Add Vendor" description="Add Vendor" /></siteMapNode>
    <siteMapNode url="PhoneList.aspx" title="Cell Phone / Ext. List" description="Cell Phone / Ext. List" />

    <siteMapNode url="http://10.0.0.231/wiki/projects/nexpressjobcalendar/calendar" title="NexPress Calendar"></siteMapNode>
    <siteMapNode url="~\docs\Job_List.pdf" title="Prep Job List" description="Prep Job List"></siteMapNode>
    <!--<siteMapNode url="WeeklySalesReport.aspx" title="Weekly Sales Report" description="Weekly Sales Report"></siteMapNode>-->
    <siteMapNode url="JobLookUp.aspx" title="Job Process Lookup" description="Job Process Lookup"></siteMapNode>
    <!--<siteMapNode url="Shipments.aspx" title="Today's Shipments" description="Today's Shipment"></siteMapNode>-->


    </siteMapNode>
    </siteMap>

    Monday, February 11, 2019 11:14 PM
  • User-1174608757 posted

    Hi RuthlessRoth,

    According to your codes , I have made a sample on my side , I find the css of menu shows as well as below:

    So the loss of css style may not  caused by the sitemap.I suggest you to solve the error firstly ,then you could check if the css of  menu goes  well.

    Here is the link to  solve the XML Parsing Error, I hope it could help you.

    https://forums.asp.net/t/2136615.aspx?XML+Parsing+Error+no+root+element+found

    Best Regards

    Wei Zhang

    Tuesday, February 12, 2019 8:04 AM
  • User1215529056 posted

    Just had time to get back to this.

    To solve the error, you are suggesting to rewrite the Web.sitemap file from this format:

    <?xml version="1.0" encoding="utf-8" ?>
    <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="Default.aspx" title="Home" description="Home" >
    <siteMapNode url="http://10.0.0.231/wiki/projects" title="Neyenesch Wikis" description="9ish Wiki" />
    <siteMapNode url="Documents.aspx" title="Documents" description="9ish Documents" />
    <siteMapNode url="ISOProcedures.aspx" title="FSC Procedures" description="ISO/FSC Procedures" >

    <siteMapNode url="VendorsShow.aspx" title="Vendors" description="Vendors" >
    <siteMapNode url="VendorAdd.aspx" title="Add Vendor" description="Add Vendor" /></siteMapNode>
    <siteMapNode url="PhoneList.aspx" title="Cell Phone / Ext. List" description="Cell Phone / Ext. List" />

    <siteMapNode url="http://10.0.0.231/wiki/projects/nexpressjobcalendar/calendar" title="NexPress Calendar"></siteMapNode>
    <siteMapNode url="~\docs\Job_List.pdf" title="Prep Job List" description="Prep Job List"></siteMapNode>
    <siteMapNode url="JobLookUp.aspx" title="Job Process Lookup" description="Job Process Lookup"></siteMapNode>


    </siteMapNode>
    </siteMap>

    to this format:

    <?xml version="1.0" encoding="utf-8" ?>
    <Menus>
        <Menu Url="~/Home.aspx" Text="Home" Value="Home Page" />
        <Menu Url="javascript:;" Text="Services" Value="Services Page">
            <SubMenu Url ="~/Consulting.aspx" Text="Consulting" Value="Consulting Page"></SubMenu>
            <SubMenu Url ="~/Outsourcing.aspx" Text="Outsourcing" Value="Outsourcing Page"></SubMenu>
        </Menu>
        <Menu Url="~/About.aspx" Text="About" Value="About Us Page" />
        <Menu Url="~/Contact.aspx" Text="Contact" Value="Contact Us Page" />
    </Menus>

    Thursday, April 11, 2019 10:40 PM
  • User1215529056 posted

    Fixed. It was simple and suggested to me on another thread.

    I tried running your code and found that the background color can be set directly through the style property <StaticMenuItemStyle> of the Menu control.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 8, 2019 8:50 PM