简体   繁体   English

MasterPage的后台代码未调用

[英]The MasterPage's behind code is not called

I just deployed my site in local with IIS manager, but for some reason when I load the page Default.aspx all C#/ASP.NET codes from MasterPage is not loaded. 我只是使用IIS管理器在本地部署了站点,但是由于某些原因,当我加载页面Default.aspx时,不会加载MasterPage上的所有C#/ ASP.NET代码。 Even though codes from the ContentPlaceHolder do show properly. 即使ContentPlaceHolder中的代码确实可以正确显示。

For exemple at the place where there is a label, when I look at the page's source code, there is nothing. 例如,在有标签的地方,当我查看页面的源代码时,没有任何东西。

Here is a portion of the code: 这是部分代码:

 <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

 <!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/Normalize.css" rel="stylesheet" />
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" />
<!-- pour la dynamicite -->
<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="tablecloth/tablecloth.js"></script>

</head>

<div id="page-wrap">
    <header>

        <div id="wrapper">
            <div id="carousel_wrapper">
                <div id="carousel" style="height: 260px;">

                    <asp:Literal ID="litCarousel1" runat="server" />
                </div>
            </div>
        </div>

        <nav id="nav-normal">

            <ul style="padding-left: 0px;">
                <li><a href="Default.aspx"><i class="icon-home icon-large"></i>&nbsp;&nbsp;Accueil</a></li>
                <li><a href="Nouscontacter.aspx"><i class="icon-envelope icon-large"></i>&nbsp;&nbsp;Nous Contacter</a></li>
                <li><a href="semaineprochaine.aspx"><i class="icon-facetime-video icon-large"></i>&nbsp;&nbsp;Semaine Prochaine</a></li>
                <li><a href="macarte57.aspx"><i class="icon-credit-card icon-large"></i>&nbsp;&nbsp;Ma Carte</a></li>

            </ul>
        </nav>

    </header>

    <asp:Literal ID="litNouveaute" runat="server" />

    .....
    <form id="form1" runat="server">

                        <div>
                            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                            </asp:ContentPlaceHolder>
                        </div>
                    </form

      ......    

After loading the page, at the place where there is litNouveaute, there is nothing. 加载页面后,在有litNouveaute的地方,什么都没有。

Is there a way to solve this please ? 有没有办法解决这个问题?

Use Label if you want to see respective HTML markup on your page. 如果要在页面上查看相应的HTML标记,请使用Label Literal control is different from Label control. Literal控件与Label控件不同。 As there is not Text assigned to your Literal control, you don't see any thing on the page there. 由于没有将文本分配给您的Literal控件,因此该页面上看不到任何东西。

Literal control simply emits static text. Literal控制只是发出静态文本。 Unlike Label , this cannot be styled. Label不同,不能设置样式。 This is a light weight control. 这是一个轻巧的控件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM