Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';在asp.net/c中将asp linkbutton标记添加到母版页#_Asp.net_Master - Fatal编程技术网

Can';在asp.net/c中将asp linkbutton标记添加到母版页#

Can';在asp.net/c中将asp linkbutton标记添加到母版页#,asp.net,master,Asp.net,Master,我正在尝试建立一个母版页。我想做的是在母版页中有一个带有登录和注册链接按钮(将更改为用户名并注销)的标题,还有像home.aspx、shoppingcart.aspx、checkout.aspx这样的内容页,它们将继承带有该标题的母版页。所以在这个过程中,我在母版页(First.master)中编写了以下代码。我试图通过以下代码继承home.aspx中的母版页:页面标记中的Inherits=“SampleMasterProject.First” <body> <form

我正在尝试建立一个母版页。我想做的是在母版页中有一个带有登录和注册链接按钮(将更改为用户名并注销)的标题,还有像home.aspx、shoppingcart.aspx、checkout.aspx这样的内容页,它们将继承带有该标题的母版页。所以在这个过程中,我在母版页(First.master)中编写了以下代码。我试图通过以下代码继承home.aspx中的母版页:页面标记中的Inherits=“SampleMasterProject.First”

<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="Header" runat="server">        
            <asp:LinkButton ID="UserNameLinkBtn" Text="UserName" runat="server"></asp:LinkButton>
            <asp:LinkButton ID="PwdLinkBtn" Text="Password" runat="server"></asp:LinkButton>
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
请帮帮我


提前感谢

内容页无法从母版页继承。以下是有关母版页的一些文档:

内容页不能从母版页继承。这里有一些关于母版页的文档:

听起来你没有正确使用母版页。内容页不会从母版页继承,而是使用“MasterPageFile”属性引用它

第一。掌握

<html>
<head>
    <title>My Web App</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="LoginLinkBtn" Text="Login" runat="server" />
        <asp:LinkButton ID="RegisterLinkBtn" Text="Register" runat="server"/>

        <asp:ContentPlaceHolder ID="MainContent" runat="server">
            This content will be replaced on each page
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

听起来你没有正确使用母版页。内容页不会从母版页继承,而是使用“MasterPageFile”属性引用它

第一。掌握

<html>
<head>
    <title>My Web App</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="LoginLinkBtn" Text="Login" runat="server" />
        <asp:LinkButton ID="RegisterLinkBtn" Text="Register" runat="server"/>

        <asp:ContentPlaceHolder ID="MainContent" runat="server">
            This content will be replaced on each page
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>
<%@ Page MasterPageFile="~/First.Master" Language="C#" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="MyApp.Home" %>

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <h3>Content For Home</h3>
</asp:Content>
namespace MyApp
{
    // This still inherits from the Page class as usual

    public partial class Home : Page
    {
    }
}