使用侧面板的母版页

发布于 2024-10-20 04:29:38 字数 211 浏览 1 评论 0原文

我在 ASP.Net 中使用母版页已有一段时间了。我已经能够开发包含页眉和页脚内容的母版页,但从未成功开发过侧面板。

该项目需要的是一个包含页眉和页脚内容的主母版页。然后另一个母版页使用第一个母版页,并具有剩余中间左侧的内容。详细信息将位于右侧,左侧主内容约为三分之一,详细信息约为三分之二。

如果可能的话,一个可行的例子会很好。

谢谢。

鲍勃

I have used Master Pages with ASP.Net for some time. I have been able to develop Master pages with header and footing content but never sucessful with side panels.

What this project needs is a Main Master page with header and footer contents. Then another master page that uses the first master page and has it's content of the left side of the remaining middle. The Detail will go to the right with the left master content about one third and the detail about two third.

A working example would be good if possible.

Thanks.

Bob

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖风昔人 2024-10-27 04:29:38

可能正在寻找嵌套母版页?

Site.master

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="MySite.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>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
  <form runat="server">
    <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
  </form>
</body>

嵌套.master

<%@ Master Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Nester.master.cs" Inherits="MySite.NestedMaster" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div style="float:left;width:200px;margin-right:5px;">
        <asp:ContentPlaceHolder runat="server" ID="LeftNavigation"></asp:ContentPlaceHolder>
    </div>
    <div style="float:left;width:440px;margin-right:5px;>
        <asp:ContentPlaceHolder runat="server" ID="MainContents"></asp:ContentPlaceHolder>
    </div>
    <div style="clear:both;"></div>
</asp:Content>

Default.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Nested.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MySite.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftNavigation" runat="server">
  <p>Left navigation content</p>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContents" runat="server">
  <p>Body content</p>
</asp:Content>

Possibly looking for nested master pages?

Site.master

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="MySite.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>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
  <form runat="server">
    <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
  </form>
</body>

Nested.master

<%@ Master Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Nester.master.cs" Inherits="MySite.NestedMaster" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div style="float:left;width:200px;margin-right:5px;">
        <asp:ContentPlaceHolder runat="server" ID="LeftNavigation"></asp:ContentPlaceHolder>
    </div>
    <div style="float:left;width:440px;margin-right:5px;>
        <asp:ContentPlaceHolder runat="server" ID="MainContents"></asp:ContentPlaceHolder>
    </div>
    <div style="clear:both;"></div>
</asp:Content>

Default.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/Nested.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MySite.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftNavigation" runat="server">
  <p>Left navigation content</p>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContents" runat="server">
  <p>Body content</p>
</asp:Content>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文