母版页选项困难 [英] Difficulty with master page options

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

问题描述


我的概率是这个.我有一个母版页,其中有两个内容占位符,一个是母版页,另一个通常是内容页.
在我的主页的内容占位符中,我有一个菜单.我希望它也总是位于我的页面和竞争页面的左侧,正如我们在许多网站中所看到的,例如. Facebook.

Hi,
My prob is this. I have a Master page in which I am having two content place holders one for master page and another for content page asusually.
In my master page''s content place holder I have a menu. I want it to be always on left side of my page and conetnt page too as we have seen in many websites For eg. Facebook.

<head runat="server">
    <title>Untitled Page</title>
    <asp:ContentPlaceHolder ID="head" runat="server" >
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
        <div>
            <table width="100%">
                <tr>
                    <td>
                        <asp:Label ID="lblUsername" runat="server" Text="Label"></asp:Label>
                    </td>
                    <td style="width: 100px;" align="right">
                        <asp:LinkButton ID="lnkLogOut" runat="server" OnClick="lnkLogOut_Click" CausesValidation="False">Log Out</asp:LinkButton>
                    </td>
                </tr>
            </table>
        </div>
        <div style:"width: 100px" align="left" >
            <asp:Panel ID="pn_SuperAdmin" runat="server">
                <table>
                    <tr>
                        <td valign = "top" bgcolor="#eeeeee">
                            <asp:Menu ID="Menu_SUPER_ADMIN" runat="server">
                                <Items>
                                    <asp:MenuItem NavigateUrl="~/myAccount.aspx" Text="Home" ToolTip="Click to go on MY ACCOUNT page"

                                        Value="Home"></asp:MenuItem>
                                    <asp:MenuItem Text="Add Client" Value="Add Client" NavigateUrl="~/Add_New_Client.aspx">
                                    </asp:MenuItem>
                                    <asp:MenuItem Text="Edit Client" Value="Edit Client" NavigateUrl="~/edit_Client_Info.aspx"

                                        ToolTip="Click here to edit existing Client's Personal Information"></asp:MenuItem>
                                    <asp:MenuItem Text="Change Password" Value="Change Password" NavigateUrl="~/change_password.aspx"

                                        ToolTip="Click here to change your Password"></asp:MenuItem>
                                    <asp:MenuItem NavigateUrl="~/Add_Edit_Normal_Admin.aspx" Text="Add/Edit Normal Admin"

                                        ToolTip="Click here to add Normal Admin" Value="Add/Edit Normal Admin"></asp:MenuItem>
                                    <asp:MenuItem></asp:MenuItem>
                                    <asp:MenuItem NavigateUrl="~/Add_Edit_Super_Admin.aspx" Text="Add/Edit Super Admin"

                                        Value="Add/Edit Super Admin"></asp:MenuItem>
                                    <asp:MenuItem Text="Create Query" 

                                        ToolTip="Click here to Create Query for Offline Data" Value="Create Query" 

                                        NavigateUrl="~/Query_For_Admin.aspx">
                                    </asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="pn_NormalAdmin" runat="server">
                <table>
                    <tr>
                        <td>
                            <asp:Menu ID="Menu_NORMAL_ADMIN" runat="server">
                                <Items>
                                    <asp:MenuItem NavigateUrl="~/myAccount_Admin.aspx" Text="Home" ToolTip="Click to go on MY ACCOUNT page"

                                        Value="Home"></asp:MenuItem>
                                    <asp:MenuItem Text="Add Client" Value="Add Client" NavigateUrl="~/Add_New_Client.aspx">
                                    </asp:MenuItem>
                                    <asp:MenuItem Text="Edit Client" Value="Edit Client" NavigateUrl="~/edit_Client_Info.aspx"

                                        ToolTip="Click here to edit existing Client's Personal Information"></asp:MenuItem>
                                    <asp:MenuItem Text="Change Password" Value="Change Password" NavigateUrl="~/change_password.aspx"

                                        ToolTip="Click here to change your Password"></asp:MenuItem>
                                    <asp:MenuItem Text="Create Query" 

                                        ToolTip="Click here to create Query for Offline Data" Value="Create Query" 

                                        NavigateUrl="~/Query_For_Admin.aspx">
                                    </asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="pn_CLEINT" runat="server">
                <table>
                    <tr>
                        <td>
                            <asp:Menu ID="Menu_CLEINT" runat="server">
                                <Items>
                                    <asp:MenuItem Text="Change Password" Value="Change Password" NavigateUrl="~/change_password.aspx"

                                        ToolTip="Click here to change your Password"></asp:MenuItem>
                                </Items>
                            </asp:Menu>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body

推荐答案

嗨 我为页面,LeftMenu和Content添加了一些CSS
请检查
hi I added some css for page, LeftMenu and Content
please check
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <asp:contentplaceholder id="head" runat="server" xmlns:asp="#unknown">
    </asp:contentplaceholder>
    <style>
        #wraper
        {
            width: 100%;
            padding: auto;
            margin: auto;
        }
        #leftMenu
        {
            width: 40%;
            float: left;
            padding: auto;
            margin: auto;
        }
        #Content
        {
            width: 60%;
            float: right;
            padding: auto;
            margin: auto;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">
    </asp:scriptmanager>
    <div id="wraper">
        <table width="100%">
            <tr>
                <td>
                    <asp:label id="lblUsername" runat="server" text="Label" xmlns:asp="#unknown"></asp:label>
                </td>
                <td style="width: 100px;" align="right">
                    <asp:linkbutton id="lnkLogOut" runat="server" onclick="lnkLogOut_Click" causesvalidation="False" xmlns:asp="#unknown">Log Out</asp:linkbutton>
                </td>
            </tr>
        </table>
        <div id="leftMenu">
            <asp:panel id="pn_SuperAdmin" runat="server" xmlns:asp="#unknown">
                <table>
                    <tr>
                        <td valign="top" bgcolor="#eeeeee">
                            <asp:menu id="Menu_SUPER_ADMIN" runat="server">
                                <items>
                                    <asp:menuitem navigateurl="~/myAccount.aspx" text="Home" tooltip="Click to go on MY ACCOUNT page">
                                        Value="Home"></asp:menuitem>
                                    <asp:menuitem text="Add Client" value="Add Client" navigateurl="~/Add_New_Client.aspx">
                                    </asp:menuitem>
                                    <asp:menuitem text="Edit Client" value="Edit Client" navigateurl="~/edit_Client_Info.aspx">
                                        ToolTip="Click here to edit existing Client's Personal Information"></asp:menuitem>
                                    <asp:menuitem text="Change Password" value="Change Password" navigateurl="~/change_password.aspx">
                                        ToolTip="Click here to change your Password"></asp:menuitem>
                                    <asp:menuitem navigateurl="~/Add_Edit_Normal_Admin.aspx" text="Add/Edit Normal Admin">
                                        ToolTip="Click here to add Normal Admin" Value="Add/Edit Normal Admin"></asp:menuitem>
                                    <asp:menuitem></asp:menuitem>
                                    <asp:menuitem navigateurl="~/Add_Edit_Super_Admin.aspx" text="Add/Edit Super Admin">
                                        Value="Add/Edit Super Admin"></asp:menuitem>
                                    <asp:menuitem text="Create Query" tooltip="Click here to Create Query for Offline Data">
                                        Value="Create Query" NavigateUrl="~/Query_For_Admin.aspx"></asp:menuitem>
                                </items>
                            </asp:menu>
                        </td>
                    </tr>
                </table>
            </asp:panel>
            <asp:panel id="pn_NormalAdmin" runat="server" xmlns:asp="#unknown">
                <table>
                    <tr>
                        <td>
                            <asp:menu id="Menu_NORMAL_ADMIN" runat="server">
                                <items>
                                    <asp:menuitem navigateurl="~/myAccount_Admin.aspx" text="Home" tooltip="Click to go on MY ACCOUNT page">
                                        Value="Home"></asp:menuitem>
                                    <asp:menuitem text="Add Client" value="Add Client" navigateurl="~/Add_New_Client.aspx">
                                    </asp:menuitem>
                                    <asp:menuitem text="Edit Client" value="Edit Client" navigateurl="~/edit_Client_Info.aspx">
                                        ToolTip="Click here to edit existing Client's Personal Information"></asp:menuitem>
                                    <asp:menuitem text="Change Password" value="Change Password" navigateurl="~/change_password.aspx">
                                        ToolTip="Click here to change your Password"></asp:menuitem>
                                    <asp:menuitem text="Create Query" tooltip="Click here to create Query for Offline Data">
                                        Value="Create Query" NavigateUrl="~/Query_For_Admin.aspx"></asp:menuitem>
                                </items>
                            </asp:menu>
                        </td>
                    </tr>
                </table>
            </asp:panel>
            <asp:panel id="pn_CLEINT" runat="server" xmlns:asp="#unknown">
                <table>
                    <tr>
                        <td>
                            <asp:menu id="Menu_CLEINT" runat="server">
                                <items>
                                    <asp:menuitem text="Change Password" value="Change Password" navigateurl="~/change_password.aspx">
                                        ToolTip="Click here to change your Password"></asp:menuitem>
                                </items>
                            </asp:menu>
                        </td>
                    </tr>
                </table>
            </asp:panel>
        </div>
        <div id="Content">
            <asp:contentplaceholder id="ContentPlaceHolder1" runat="server" xmlns:asp="#unknown">
            </asp:contentplaceholder>
        </div>
    </div>
    </form>
</body>
</head>


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

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