如何将HTML页面模板转换为母版页? [英] How to i convert an HTML Page template into a masterpage?

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

问题描述

如何在asp.net中将HTML页面模板转换和使用为主页?

How to i convert and use HTML Page template into a masterpage in asp.net?

推荐答案

该主页看上去与ASPX文件非常相似,除了母版页将具有.master文件扩展名而不是.aspx扩展名,并且在顶部使用@Master指令而不是@Page指令.母版页将定义< html> ;、< head> ;、< body>和< form>标签.您还将希望在母版页中添加ContentPlaceHolder控件. ContentPlaceHolder控件是我们希望我们的ASPX Web表单放置其内容的地方.

因此,如果要将模板转换为母版页,则需要执行以下操作:

1.使用@Master指令代替@page指令;

2.在页面上添加一个或多个contentplaceholder控件;

3.使用.master文件扩展名而不是.aspx扩展名.

我建议您首先创建一个新的ASPX页面,然后从现有页面复制它,然后将其转换为母版页面之前,先将其缩减为常见元素.创建一个新的母版页也是值得的,以便您有一个可以使用的示例.
The master page looks very similar to an ASPX file, except a master page will have a .master file extension instead of a .aspx extension, and uses an @Master directive instead of an @Page directive at the top. Master pages will define the <html>, <head>, <body >, and <form> tags. You will also want to add ContentPlaceHolder controls in the master page. ContentPlaceHolder controls are where we want our ASPX web forms to place their content.

So, if you want to convert the template to master page, you need to do:

1. Use @Master directive instead of @page directive;

2. Add one or more contentplaceholder controls on the page;

3. Use .master file extension instead of the .aspx extension.

I suggest you first create a new ASPX page which you copy from your existing page, then cut down to just the common elements before converting it to a master page. It is also worth creating a new master page so that you have an example to work from.


这篇关于如何将HTML页面模板转换为母版页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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