本文介绍了我没有在登录页面获得Master Page的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我在母版页上没有登录页面。



如何在登录页面获取母版页。





Dear All,

I did''t get login page in master page.

how to get the master page in login page.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" MasterPageFile="~/MasterPage.master" %>


<!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>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login"  %>


<!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>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            height: 23px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        
        <table class="style1">
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="User Login">
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label2" runat="server" Text="Username">
                </td>
                <td class="style2">
                    <asp:TextBox ID="TextBox1" runat="server">
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="Password">
                </td>
                <td>
                    <asp:TextBox ID="TextBox2" runat="server">
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnLogin" runat="server" Text="Login" />
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td>
                     </td>
                <td>
                     </td>
            </tr>
        </table>
        
    </div>
    </form>
</body>
</html>

推荐答案


<%@ Page Language="C#" CodeBehind="Login.aspx.cs" MasterPageFile="~/MasterPage.master"

    AutoEventWireup="True" Debug="true" Inherits="Login" %>


<asp:Content ID="cntLogin" ContentPlaceHolderID="cphLogin" runat="server">

<style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            height: 23px;
        }
    </style>


<table class="style1">
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="User Login">
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style2">
                    <asp:Label ID="Label2" runat="server" Text="Username">
                </td>
                <td class="style2">
                    <asp:TextBox ID="TextBox1" runat="server">
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="Password">
                </td>
                <td>
                    <asp:TextBox ID="TextBox2" runat="server">
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnLogin" runat="server" Text="Login" />
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td>
                     </td>
                <td>
                     </td>
            </tr>
        </table>

</asp:Content>


<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>



All you need place ContentPlaceHolderID for head abd body and Determine MasterPageFile in page directive

Best Regards

M.Mitwalli


All you need place ContentPlaceHolderID for head abd body and Determine MasterPageFile in page directive
Best Regards
M.Mitwalli


这篇关于我没有在登录页面获得Master Page的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 00:52