如何将母版页添加到现有网页? [英] How to add a master page to an existing web page?

查看:123
本文介绍了如何将母版页添加到现有网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我再次需要您的帮助,以至于找不到有关如何将母版页添加到现有网页的解决方案.

你能帮我吗?

等待有人回复.

问候

Haluk

Hello guys,

I need your help again that I couldn''t find a solution about how to add a master page to an existing web page.

Could you help me pls?

Awaiting somebody reply.

Regards

Haluk

推荐答案

您必须声明应在页面指令中使用的母版,例如
You have to declare the master page that should be used in your page directive like
<% @ Page Language="VB" MasterPageFile="~/Master.master" Title="Content Page 1" %>



但这还远远不够,因为使用母版页还需要在现有页面中定义内容"控件.您应该看一下在

http://msdn.microsoft.com/en-us/library /wtxbf3hh(v=vs.100).aspx#Y346 [



But that most probably won''t be enough since using a master page also requires defining the Content controls in your existing page. You should have a look e.g. at

http://msdn.microsoft.com/en-us/library/wtxbf3hh(v=vs.100).aspx#Y346[^]


请检查以下链接.
1.
将母版页添加到现有页面 [如何将母版页应用于现有网页或轻松转换现有的Web表单到Web内容表单(带有母版页) [视频-将ASP .NET母版页添加到现有项目中 [
Please check the below links.
1. add master page to an existing page[^]
2. How to apply a Master Page to Existing Webpage OR Easily convert An Existing Web Form to a Web Content Form(with a Master Page)[^]
3. Video - Adding an ASP .NET Master Page to an existing project[^]


在您的页面指令中添加此属性.
Add this property in your page directive.
<%@ Page MasterPageFile="myMaster.master" %>



您需要除去form标记内容之外的所有内容.




The you need to remove everything apart from the contents of the form tag.


<asp:Content id="ContentPlaceholder2" runat="server" ContentPlaceholderId="MasterID">

 paste content of form tag

</asp:Content>



ContentPlaceholderId id必须是母版页中ContentPlaceHolder的id.



ContentPlaceholderId id must be id of ContentPlaceHolderfrom master page.


这篇关于如何将母版页添加到现有网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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