MasterPage不会显示在其他页面上

时间:2016-11-02 09:24:21

标签: asp.net background master-pages content-pages

我尝试制作我们网站的新主页并完成。我的母版页可以显示在主页上,也可以作为背景图片和菜单显示在登录页面上。但登录门户后,我的母版页菜单和背景图片无法在其他页面上显示。我该怎么做才能显示背景图片和菜单?

<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
    <!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
    <!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
    <!--[if IE 9]>    <html class="no-js ie9 oldie" lang="en"> <![endif]-->
    <meta charset="utf-8">
    <!-- Set the viewport width to device width for mobile -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title>Bootstrap Templates</title>
    <!-- ============ Google fonts ============ -->
    <link href='http://fonts.googleapis.com/css?family=EB+Garamond' rel='stylesheet'
        type='text/css' />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300,800'
        rel='stylesheet' type='text/css' />
    <!-- ============ Add custom CSS here ============ -->
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    <link href="css/font-awesome.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .auto-style1 {
            width: 5px;
        }
    </style>
</head>

<body>


<form runat =server >

    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <script src="js/jquery.backstretch.js" type="text/javascript"></script>
    <script type="text/javascript">
        'use strict';

        /* ========================== */
        /* ::::::: Backstrech ::::::: */
        /* ========================== */
        // You may also attach Backstretch to a block-level element
        $.backstretch(
        [
            "img/44.jpg",
            "img/colorful.jpg",
            "img/34.jpg",
            "img/images.jpg"
        ],

        {
            duration: 4500,
            fade: 1500
        }
    );
    </script>
<div id="custom-bootstrap-menu" class="navbar navbar-default " role="navigation">
        <div class="container">
            <div class="navbar-header">                     

                <asp:LoginView ID="LoginView1" runat="server">
                          </asp:LoginView>  <asp:LoginStatus  class="navbar-brand" ID="LoginStatus1" runat="server" Font-Names="Verdana" Font-Size="Large"  ForeColor = "White"/>

            </div>              

            <div class="collapse navbar-collapse navbar-menubuilder">
                <ul class="nav navbar-nav navbar-right">

                    <li><a href="/">Ana Sayfa</a> </li>                     

        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Personel Islemleri <span class="caret"></span></a>
          <ul class="dropdown-menu" style="background-color: #33CCFF">
            <li><a href="personel/welcome.aspx">Kisisel Bilgiler</a></li>
            <li><a href="personel/hcmt37.aspx">Bordro</a></li>
            <li><a href="personel/een114.aspx">Netting</a></li>
            <li><a href="personel/expenses.aspx">Harcama Beyani</a></li>
            <li><a href="personel/travels.aspx">Seyahat</a></li>
            <li><a href="personel/missions.aspx">Gorev</a></li>
            <li><a href="personel/maints.aspx">Servis Talebi</a></li>
          </ul>
        </li>

        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Amir Islemleri <span class="caret"></span></a>
          <ul class="dropdown-menu" style="background-color: #FF99CC">
            <li><a href="amir/leaves.aspx">Izin Onaylari</a></li>
            <li><a href="amir/expenses.aspx">Harcama Onaylari</a></li>
            <li><a href="amir/travels.aspx">Seyahat Onaylari</a></li>
            <li><a href="personel/expenses.aspx">Gorev Onaylari</a></li>

          </ul>
        </li>

        <li><a href="/ias/PASSW.aspx">Parola Degistir</a> </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container">     

    <table>   

        <tr>
     <td style="height: 1px; background-color: Black">
                <asp:Menu ID="Menu1" runat="server" BackColor="Black" DynamicHorizontalOffset="2"
                    Font-Names="Verdana" Font-Size="0.8em" ForeColor="White" Height="24px" Orientation="Horizontal"
                    StaticSubMenuIndent="10px" Width="864px" Visible="False">
                    <StaticSelectedStyle BackColor="Black" />
                    <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="1px" BackColor="Black" ForeColor="White" />
                    <DynamicHoverStyle BackColor="Black" ForeColor="White" />
                    <DynamicMenuStyle BackColor="Black" />
                    <DynamicSelectedStyle BackColor="Black" ForeColor="White" />
                    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" BackColor="Black" ForeColor="White" />
                    <StaticHoverStyle BackColor="Black" ForeColor="White" />
                    <Items>
                        <asp:MenuItem NavigateUrl="~/memberpages/welcome.aspx" Text="Ana Sayfa" Value="Ana Sayfa">
                        </asp:MenuItem>
                        <asp:MenuItem NavigateUrl="~/memberpages/hcmt37.aspx" Text="Bordro" Value="Bordro"></asp:MenuItem>
                        <asp:MenuItem NavigateUrl="~/memberpages/een114.aspx" Text="Netting" Value="Netting">
                        </asp:MenuItem>

                        <asp:MenuItem Text="Onaylar" Value="Onaylar">
                            <asp:MenuItem Text="Izin" Value="Izin" NavigateUrl="~/authpages/leaves.aspx"></asp:MenuItem>
<asp:MenuItem Text="Harcama" Value="Harcama" NavigateUrl="~/authpages/expenses.aspx"></asp:MenuItem>
<asp:MenuItem Text="Seyahat" Value="Seyahat" NavigateUrl="~/authpages/travels.aspx"></asp:MenuItem>
<asp:MenuItem Text="G&#246;rev" Value="G&#246;rev" NavigateUrl="~/authpages/missions.aspx"></asp:MenuItem>

                        </asp:MenuItem>

                          <asp:MenuItem Text="Talepler" Value="Talepler">
                            <asp:MenuItem Text="Izin" Value="Izin" NavigateUrl="~/memberpages/leaves.aspx"></asp:MenuItem>
<asp:MenuItem Text="Harcama Beyani" Value="Harcama" NavigateUrl="~/memberpages/expenses.aspx"></asp:MenuItem>
<asp:MenuItem Text="Seyahat" Value="Seyahat" NavigateUrl="~/memberpages/travels.aspx"></asp:MenuItem>
<asp:MenuItem Text="G&#246;rev" Value="G&#246;rev" NavigateUrl="~/memberpages/missions.aspx"></asp:MenuItem>

                        </asp:MenuItem>                          

<asp:MenuItem Text="Sifre Degistir" Value="Sifre Degistir" NavigateUrl="~/ias/PASSW.aspx"></asp:MenuItem>

                    </Items>
                    <StaticMenuStyle BackColor="Black" ForeColor="White"  />
                </asp:Menu>
            </td>  

        </tr>
        <tr>
            <td style="width: 891px; height: 96px" valign="top">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
            </td>

        </tr>
        </table>

</div>
      <div id="masterpageContent" class="footer">
        <asp:ContentPlaceHolder ID="MainContent" runat="server" />
      </div>
    </div>
    <div class="footerContent">
        <div class="footerbrd">
        </div>
        <p class="clear">
        </p>
        <div class="footer">
            <div class="c1 flef">
                2010 Copyright Bilgi Islem
            </div>

            <p class="clear">
            </p>
        </div>
    </div>  

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

1 个答案:

答案 0 :(得分:0)

您的问题并不清楚,但您是否修改了所有其他页面以使其使用母版页?向项目添加母版页并不意味着所有现有页面都会突然开始使用它。

使用母版页的.aspx页面应如下所示:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="WebFormWithMasterPage.aspx.cs" Inherits="TestOmgeving.WebFormWithMasterPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <!-- all page content goes here -->

</asp:Content>