gpt4 book ai didi

c# - Asp.net 中的母版页未加载代码实现

转载 作者:太空宇宙 更新时间:2023-11-03 17:31:39 25 4
gpt4 key购买 nike

我是 asp.net 的新手!按照教程 http://www.youtube.com/watch?v=aUx2Bdx68f4我已经编写了成功构建的代码!但是当我执行这个时它显示了以下错误: enter image description here

样式表

body
{
font-family: 'lucida grande' ,tahoma,verdana,arial,sans-serif;
background-color: #e9e9e9;
}
#wrapper
{
width: 1080px;
margin: 0 auto;
padding:10px;
border: 5px solid #dedede;
background-color: #fff;
}
#banner
{
height: 200px;
border: 3px solid #e3e3e3;
background-image:url(../Styles/kk.jpg);
background-repeat: no-repeat;
background-size : cover;
}
#navigation
{
height: 60px;
border: 3px solid #e3e3e3;
margin-top:20px;
background-image:url(../Styles/kk.jpg);
}
#content_area
{
float: left;
width: 750px;
margin: 20px 0 20px 0;
padding: 10px;
border: 3px solid #e3e3e3;
}
#sidebar
{
float: right;
width: 250px;
height:400px;
margin:20px 10px 20px 10px;
border: 3px solid #e3e3e3;
}
#footer
{
clear:both;
width: auto;
height:40px;
margin-top:20px;
background-image:url(../Styles/kk.jpg);
}

母版页代码

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>My Website</title>
<link rel= "StyleSheet1" type="text/css" href ="~/Style/StyleSheet1.css" />

</head>
<body>
<form id="form1" runat="server">
<div id="wrapper">
<div id="banner">
</div>
<ul id="navigation">
</ul>
<div id="content_area">
</div>
<div id="sidebar">
</div>
<div id="footer">
<p> All rights reserved.</p>
</div>
</div>
</form>
</body>
</html>

谁能帮我解决我的问题?

最佳答案

母版页不是直接执行的,您需要创建 aspx 页面,然后在其中包含该母版页。

将该aspx页面设置为启动页面,然后执行程序。

添加母版页:

您的@page 指令应具有 MasterPageFile="~/MasterPage.master"

属性

您的整个@page 指令应如下所示:

<%@ Page Title="" Language="c#" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="ASPXPageName.aspx.cs" Inherits="NamespaceName.ASPXPageName" %>

添加aspx时会有以下步骤:

enter image description here

enter image description here

可以按照下面的文档:

http://msdn.microsoft.com/en-us/library/aa581781.aspx

关于c# - Asp.net 中的母版页未加载代码实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19853246/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com