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 を混乱させないように、タグ内にスペースを追加する必要がある場合があります。すなわち。< % =あなたはまだあなたのコメントを理解できるはずです。

于 2012-04-21T06:08:31.517 に答える