如何添加母版页已创建Web窗体? [英] How to add master page to already created webform?
问题描述
我有一个asp.net应用程序的网页表单。现在我要在这个应用程序中添加母版页,但我不知道如何合并或旧的web表单添加新创建的主网页?如何处理web表单的html如< HEAD>
,<身体GT;
?在这方面,任何一个环节会有所帮助。
I have a asp.net webform application. Now I have to add master page in this application, but I don’t know how to merge or add new created master page with old webforms? How to handle html in webforms like <head>
, <body>
? Any link in this regard will be helpful.
推荐答案
1定义在设计中固定的元素,并把它们新创建的母版页内
1- Define the fixed elements in your design, and put them inside the newly created master page
2 - 定义动态的,并添加 ASP:的ContentPlaceHolder
他们(最常见的一个 HEAD
,一个是在你的 BODY
,主要内容和一个端内容的如果适用的)
2- Define the dynamic ones, and add asp:ContentPlaceHolder
for them ( most commonly one for HEAD
, one for main content in your BODY
, and one for side content "if applicable")
3在你的页面,添加的MasterPageFile =〜/ MASTER_PAGE_PATH
Page指令里面。
3- In your pages, add MasterPageFile="~/MASTER_PAGE_PATH"
inside the Page directive.
4-添加 ASP:内容
页面内的部分,将用来保存在你的页面的动态内容,而且不要忘记引用正确的的ContentPlaceHolder ID
。
4- Add asp:Content
sections inside your pages which will hold the dynamic content in your pages, and don't forget to reference the correct ContentPlaceholder ID
.
5复制您的网页内容,这些 ASP内部:内容
部分,并且BOOOOM ....你做
5- Copy your page content inside these asp:content
sections, and BOOOOM....you are done.
这篇关于如何添加母版页已创建Web窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!