我没有在登录页面获得Master Page [英] I did't get Master Page in Login Page

查看:82
本文介绍了我没有在登录页面获得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>

推荐答案

添加新页面时,您可以选择选择母版页。



请参阅此详细说明以及如何操作: [ ^ ]



本文包含逐步程序来执行此操作。
While adding a new page you can select to choose master page.

see this for detailed explanation and how to do it: Beginner''s Tutorial on Master Pages in ASP.NET[^]

this article contains Step by step procedure to do it.


<%@ 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>




试试这个

Hi ,
try this
<%@ 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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