如何在不更改内容页面内容的情况下将母版页面添加到现有页面 [英] How to add master page to existing page without changing contentin content page

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

问题描述

晚安朋友,
1.我设计了一个带有两个标签,两个文本框和一个按钮的网页.只需登录表单即可.
2.我在网页之后创建了母版页.
3.在该主页中,我添加了图像,背景色等.
4.我尝试使用母版页访问现有网页

错误:
我只能获取母版页布局,看不到标签,文本框和按钮.

请帮帮我.

预先表示感谢.

Good Evening Friends,
1. I have designed a webpage with two labels and two textbox and with a button.Just login form layout.
2. I have created the masterpage after the webpage.
3. In that master page i have added images, background color and so on.
4. I have tried to use the master page to the existing webpage

ERROR:
I am able to get the master page layout only, I can''t see the labels, textboxes and buttons.

Please help me.

Thanks in advance.

推荐答案

最简单的方法是在已设置母版页的情况下添加新页,然后将原始页中的内容复制到内容中控制.

如果要手动执行,则必须确保母版文件在页面标记中列出,即:
The easiest way would be to add new a new page with the masterpage already set then copy what you have done in the original page into the content control.

If you want to do it manually then you have to make sure the masterpagefile is list in the page tag ie:
MasterPageFile="masterpage url"


然后使用相应的ContentPlaceHolderID添加内容控件:


Then add the content control with the corresponding ContentPlaceHolderID:

<asp:content id="Content2" contentplaceholderid="ContentPlaceHolder1" runat="Server" xmlns:asp="#unknown"></asp:content>br mode="hold" />Then cut/paste your pages html into that... Note that all head and body html components should be removed as they are already covered in the master page.


步骤:
1.创建一个母版页
2.通过设计模式在现有网页中应用母版页
3.复制内容容器
4.在您的Web窗体中,将Web控件和信息移动到适当的内容容器中.

在这里,请看一下这个博客,其中介绍了使用母版页支持现有页面的步骤:视频:将ASP .NET母版页添加到现有项目-YouTube [ ^ ]
Steps:
1. Create a Master Page
2. Apply Master Page via design mode in existing web page
3. Copy over the Content Containers
4. In your Web Form, move Web Controls and information into the proper Content Containers.

Here, have a look at this blog explaining steps to support existing page with Master page: 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) [^]

Step-by-step: Video: Adding an ASP .NET Master Page to an existing project - YouTube[^]


这篇关于如何在不更改内容页面内容的情况下将母版页面添加到现有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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