我的设计视图不再显示,但网站运行正常。

时间:2012-04-21 05:49:32

标签: site.master

我为我的网站使用母版页,出于某种原因,我无法再在设计视图中查看母版页。出现的只是一个带有闪烁光标的空白页面。我已经超过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>

1 个答案:

答案 0 :(得分:0)

我认为你对ASP标签的评论让Visual Studio感到困惑。尝试从评论中删除<%= <%# %>,看看是否有帮助。如果这是你的问题,你可能需要在标签内添加空格,这样它们就不会混淆VS.即。 < % =您仍应该能够理解您的意见。