开发者

Master Pages using Side Panels

开发者 https://www.devze.com 2023-02-14 11:23 出处:网络
I have used Master Pages with ASP.Net for some time. I have been able to develop Master pages with header and fo开发者_如何转开发oting content but never sucessful with side panels.

I have used Master Pages with ASP.Net for some time. I have been able to develop Master pages with header and fo开发者_如何转开发oting 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


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消