0

我为我的网站使用母版页,但由于某种原因,我无法再在设计视图中查看母版页。出现的只是一个带有闪烁光标的空白页。我已经玩了2个多小时了,无法弄清楚。然而,当我运行它时,一切看起来和表现都很好。我错过了什么?

这是 Site.Master 代码:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="WebApplication2.SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head runat="server">
<title></title>
<%--Here is where you reference your style sheets and JQuery library.  The link href takes the
    relative path and publishes fine for the directory.  With <script> and <style> tags, copies 
    like the JQuery reference, you will need to use the '<%# Page.ResolveClientUrl() %>' to get 
    the same relative path behavior at publishing time.  Typically you would define a code block
    and choose '<%=' however page headers don't play nice with code blocks.  '<%#' defines as a
    databinding expression and then when you add Page.Header.Databind() to your code behind for
    the master page, The DataBind method evaluates all the databinding expression(s) in your 
    header at load time--%>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<link href="~/Styles/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%# Page.ResolveClientUrl("~/Scripts/jquery-1.4.1.min.js") %>"></script>

<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>
</head>

<body>
<form id="form1" runat="server">
<%--The ScriptManager is a what is used by the Microsoft controls to provide AJAX functionality.
    It needs to exist for the the AJAX libraries to be referenced and placing it right below the 
    Master's page Form tag is the best place--%>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

<div class="page">
    <div class="header">
        <div class="title">
            <h1>
                SalesPro Technologies Online 
            </h1>
        </div>

        <div class="loginDisplay">
            <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                <AnonymousTemplate>
                    [ <a href="~/Account/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                </AnonymousTemplate>
                <LoggedInTemplate>
                    Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                    [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" 
                        LogoutAction="RedirectToLoginPage" LogoutText="Log Out" 
                        LogoutPageUrl="~/Account/Login.aspx"/> ]
                </LoggedInTemplate>
            </asp:LoginView>
        </div>

        <div id="divMenu" class="clear hideSkiplink">

            <%-- The following code is for a traditional menu bar to appear:
                 <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" 
                      Width="40%" Orientation="Horizontal">
                 <Items>
                     <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                     <asp:MenuItem NavigateUrl="~/About.aspx" Text="About"/> 
                 </Items> 
                 </asp:Menu> --%>

            <asp:LinkButton CssClass="LinkCss floatleft" ID="linkHome" runat="server" 
                PostBackUrl="~/Default.aspx">Home</asp:LinkButton>
            <asp:LinkButton CssClass="LinkCss floatright" ID="linkAbout" runat="server" 
                PostBackUrl="~/About.aspx">About</asp:LinkButton>          
            <asp:LinkButton CssClass="LinkCss floatright" ID="linkOptions" runat="server">Options</asp:LinkButton>
            <asp:LinkButton CssClass="LinkCss floatright" ID="linkReports" runat="server" 
                PostBackUrl="~/reports.aspx">Reports</asp:LinkButton>  
        </div>

    </div>
    <div class="main">
        <asp:ContentPlaceHolder ID="MainContent" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    <div class="clear">
    </div>
</div>

<div class="footer">     
</div>

</form>

</body>
</html>
4

1 回答 1

0

我认为您在其中带有 ASP 标记的评论使 Visual Studio 感到困惑。尝试<%= <%# %>从您的评论中删除,看看是否有帮助。如果这是您的问题,您可能需要在标签中添加空格,以免它们混淆 VS。IE。< % =您应该仍然能够理解您的评论。

于 2012-04-21T06:08:31.517 回答