[英]ASP.Net C# Master Site
I have a question about the ****.Master Site a in ASP.NET with C# (WebForms). 我对使用C#(WebForms)的ASP.NET中的****。Master网站有疑问。 I've created a Site.Masters File with a lot of differente Placeholders inside.
我创建了一个Site.Masters文件,其中包含许多不同的占位符。 So the question is - is it possible to fill the Placeholders from different .aspx Files?
因此,问题是-是否可以从不同的.aspx文件填充占位符?
.Master Page: 。主页面:
<asp:ContentPlaceHolder ID="MainHeader" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="MainFooter" runat="server">
</asp:ContentPlaceHolder>
</div>
Now i would do something like this: 现在我会做这样的事情:
Is this possible or is there a solution for my plan? 这可能吗?或者我的计划有解决方案吗? I would like to create a modular and flat structure of my .NET Project.
我想为我的.NET Project创建一个模块化的扁平结构。
Thanks for your help - best regards 感谢您的帮助-最好的问候
No, that's not how Master Pages work. 不,那不是母版页的工作方式。
When the user/client requests an individual content Page, that Page is merged with the Master Page. 当用户/客户端请求单个内容页面时,该页面将与母版页合并。 The Master Page can not be called by the user/client.
用户/客户端无法调用母版页。
I believe User Controls are what you are looking for. 我相信您正在寻找用户控件 。
You can do what you want by using jquery.load(), here is the documentation http://api.jquery.com/load/ , however i think what you are doing is not the way to procede, in order to do what you want i suggest yo to do this: 您可以通过使用jquery.load()来完成所需的操作,这是文档http://api.jquery.com/load/ ,但是我认为您要做的不是继续进行的方法,而是要执行的操作您希望我建议您这样做:
Create User Controls, one for each master ContentPlaceHolder, then in your master, add each one of this and initiate them. 创建用户控件,每个主控件一个ContentPlaceHolder,然后在主控件中,添加每个控件并启动它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.