asp.net 4.5practice〜test10-1

この演習では、マスターページの内容を学習します。

ルートディレクトリにフォルダを作成し、画像を配置します。自分で画像を描画できます。サイズは約1024 * 100、パスはImages /header.jpgです。

MasterPage.Master

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>母版页</title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
        <table style="width:768px;height:100%; border-width:0;border-collapse:collapse;">
            <tr>
                <td style="width:100%;height:142px;background-image:url('Images/header.jpg')"></td>
            </tr>
            <tr>
                <td style="width:100%;">
                    <table style="width:100%;border-width:0;height:105px;border-collapse:collapse;">
                        <tr>
                            <td style="width:244px;">
                                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                                    <p style="height:103px;">&nbsp;<br /></p>
                                </asp:ContentPlaceHolder>
                            </td>
                            <td>
                                <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
                                    <p style="height:103px;"><br /></p>
                                </asp:ContentPlaceHolder>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="width:100%;height:35px;text-align:center;">Copyright <span>2020-2030</span></td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

webform1.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test10_1.WebForm1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:LinkButton ID="LinkButton1" runat="server">服务指南</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton2" runat="server">书刊检索</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton3" runat="server">特殊馆藏</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton4" runat="server">文献提供</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton5" runat="server">读者园地</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton6" runat="server">专题活动</asp:LinkButton><br />
    <asp:LinkButton ID="LinkButton7" runat="server">相关链接</asp:LinkButton><br />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <asp:Label ID="Label1" runat="server" Text="欢迎进入网站,学习母版页的内容!" Font-Size="XX-Large" style="color:#00345a;font-weight:700;"></asp:Label>
</asp:Content>

 

 

おすすめ

転載: blog.csdn.net/modern358/article/details/114641556