zoukankan      html  css  js  c++  java
  • Asp.net母版和使用母版的窗体

    1.效果截图和思路

    2014-04-08_215124

    思路:首先在Adobe Dreamweaver CS6写好Css和Html。

    然后添加母版页。再添加使用母版页的窗体。

    母版的好处:母版里放置的是DIV布局,不用每个页面重复的写DIV布局,使用母版的页面可以共用一个DIV布局。甚至可以共用一个Css+Div模板。

    2.母版

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site2.master.cs" Inherits="WebForm1.Site2" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <asp:ContentPlaceHolder ID="head" runat="server">
        </asp:ContentPlaceHolder>
    </head>
    <body>
        <form id="form1" runat="server">
        <div id="title">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
            
            </asp:ContentPlaceHolder>
        </div>
    
           <div id="top">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
            
            </asp:ContentPlaceHolder>
        </div>
    
           <div id="left">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
            
            </asp:ContentPlaceHolder>
        </div>
    
           <div id="right">
            <asp:ContentPlaceHolder ID="ContentPlaceHolder4" runat="server">
            
            </asp:ContentPlaceHolder>
        </div>
    
     
        </form>
    </body>
    </html>

    对应的简单的DIV布局示意图

    2

    3.使用母版的窗体

    首先添加一个Css文件StyleSheet1.css进工程

    body{
        margin: 0 auto; 
        text-align:center;
        800px;
        
    }
        
    div#title{
        
        800px;
        height:130px;
        
    }
    
    div#top{
        
        800px;
        height:200px;
    }
    
    
    div#left{
        
        25%;
        height:300px;
        float:left;
    }
    
    div#right{
        
        75%;
        height:300px;
        float:left;
    }

    添加使用母版的窗体

    引用CSS文件

    <link rel=Stylesheet href=StyleSheet1.css />

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site2.Master" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebForm1.WebForm3" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel=Stylesheet href=StyleSheet1.css />
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <img src="./Image/title.png"  width="770px"
        height="120px" />
    </asp:Content>
    
    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <img src="./Image/top.png"  width="770px"/>
    </asp:Content>
    
    <asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <img src="./Image/q1.png" />
    </asp:Content>
    
    <asp:Content ID="Content5" ContentPlaceHolderID="ContentPlaceHolder4" runat="server">
    <img src="./Image/q2.png" />
    </asp:Content>
  • 相关阅读:
    delphi内存管理
    Dbgrid导出为word
    indy传输文件
    TMethod
    http状态码详解
    如何严格设置php中session过期时间
    http和https的优缺点,区别与工作原理
    session的生命周期
    Mysql分库分表方案,如何分,怎样分?
    【观点】程序员应知——循序渐进 狼人:
  • 原文地址:https://www.cnblogs.com/Energy240/p/3653088.html
Copyright © 2011-2022 走看看