设计母版页所需的帮助 [英] Help needed in design of a master page

查看:76
本文介绍了设计母版页所需的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想设计一个母版页,例如在顶部有一个徽标,然后是一个水平菜单,在左侧有一个树状视图.我已经做到了,但是我仍然需要知道如何创建一个位置,在该位置页面的特定空间将具有图像作为背景,并显示在具有该母版页的所有网页上.

请帮帮我.

I want to design a master page such as there is a logo right at the top followed by a horizontal menu and on the left hand side there will be a treeview. I have made that already, but I still need to know how I can create a place where the page specific space will have an image as a background which is displayed on all the webpages with that master page.

Please help me.

Thanks to your response!

推荐答案

用以下内容替换母版页内容,并更改徽标和树视图节点.

Replace Master Page content with following and change your logo and treeview nodes.

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

<!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>Untitled Page</title>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
        }
        .style3
        {
            width: 70%;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <table class="style1">
            <tr>
                <td colspan="2">
                    <asp:Image ID="Image1" runat="server" Height="100px" ImageUrl="~/ajaxhead.png"

                        Width="100%" />
                </td>
            </tr>
            <tr>
                <td class="style2" colspan="2" >

                    &nbsp;</td>
            </tr>
            <tr>
                <td class="style2" style="text-align: left" >

                    <asp:TreeView ID="TreeView1" runat="server">
                        <Nodes>
                            <asp:TreeNode Text="Home" Value="Home"></asp:TreeNode>
                            <asp:TreeNode Text="About Us" Value="About Us"></asp:TreeNode>
                        </Nodes>
                    </asp:TreeView>

                </td>
                 <td class="style3">
                     <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                    </asp:ContentPlaceHolder></td>
            </tr>
            <tr>
                <td class="style2">
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>

    </div>
    </form>
</body>
</html>





之后,从解决方案资源管理器中选择添加新项",并在添加新项"对话框中选中选择母版页.





After that Select Add New Item from Solution Explorer, with checked Select Master Page in Add New Item Dialog box.


这篇关于设计母版页所需的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆