⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aspnet_masterpages.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>ASP.NET 2.0 Master Pages</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>

<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

<h1>ASP.NET 2.0 - Master Pages</h1>
<a href="aspnet_newfeatures.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" /></a>
<a href="aspnet_navigation.asp"><img alt="next" border="0" src="../images/btn_next.gif" /></a>
<hr />
<p class="intro">Master pages provide templates for other pages on 
your web site. </p>
<hr />

<h2>Master Pages</h2>

<p>Master pages allow you to create a consistent look and behavior for all the pages 
(or group of pages) in your web application.</p>
<p>A master page provides a template for other 
pages, with shared layout and functionality. The master page 
defines placeholders for the content, which can be overridden by content pages. 
The output result is a combination of the master page and the content page. </p>

<p>The content pages contains the content you want to display. 
</p>
<p>When users request the content page, 
ASP.NET merges the pages to produce output that combines the layout of the master page with the content 
of the content page.
</p>
<hr />

<h2>Master Page Example:</h2>

<table border="1" width="100%" class="ex" cellspacing="0">
<tr><td>
<pre>&lt;%@ Master %&gt;

&lt;html&gt;
&lt;body&gt;
&lt;h1&gt;Standard Header For All Pages&lt;/h1&gt;

&lt;asp:ContentPlaceHolder id=&quot;CPH1&quot; runat=&quot;server&quot;&gt;
&lt;/asp:ContentPlaceHolder&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
</td></tr>
</table>
<p>The master page above is a normal HTML page designed as a template for  
other pages.</p>
<p>The <b>@ Master</b> directive defines it as a master page.</p>
<p>The master page contains a placeholder tag <b>&lt;asp:ContentPlaceHolder&gt;</b> for 
individual content.</p>
<p>The <b>id=&quot;CPH1&quot;</b> attribute identifies the placeholder, allowing many 
placeholders in the same master page.</p>
<p>This master page was saved with the name <b>&quot;master1.master&quot;</b></p>
<p><img border="0" src="../images/lamp.gif" width="15" height="15" alt="lamp" /> Note: The 
master page can also contain code, allowing dynamic content.</p>


<hr />

<h2>Content Page Example:</h2>

<table border="1" width="100%" class="ex" cellspacing="0" id="table2">
<tr><td>
<pre>&lt;%@ Page MasterPageFile=&quot;master1.master&quot; %&gt;

&lt;asp:Content
ContentPlaceHolderId=&quot;CPH1&quot; runat=&quot;server&quot;&gt;

&lt;h2&gt;Individual Content&lt;/h2&gt;
&lt;p&gt;Paragrap 1&lt;/p&gt;
&lt;p&gt;Paragrap 2&lt;/p&gt;

&lt;/asp:Content&gt;</pre>
</td></tr>
</table>
<p>The content page above is one of the individual content pages of the web.</p>
<p>The <b>@ Page</b> directive defines it as a standard content page.</p>
<p>The content page contains a content tag <b>&lt;asp:Content&gt;</b> with a reference 
to the master page (ContentPlaceHolderId=&quot;CPH1&quot;).</p>
<p>This content page was saved with the name <b>&quot;mypage1.aspx&quot;</b> </p>
<p>When the user requests this page, ASP.NET merges the content page with the 
master page.</p>
<p><a target="_blank" href="mypage1.aspx">Click to display mypage1.aspx.</a></p>
<p><img border="0" src="../images/lamp.gif" width="15" height="15" alt="lamp" /> Note: The 
content text must be inside the &lt;asp:Content&gt; tag. No content is allowed outside 
the tag.</p>


<hr />

<h2>Content Page With Controls:</h2>

<table border="1" width="100%" class="ex" cellspacing="0" id="table3">
<tr><td>
<pre>
&lt;%@ Page MasterPageFile=&quot;master1.master&quot; %&gt;<br />
<br />&br&lt;asp:Content<br />ContentPlaceHolderId=&quot;CPH1&quot; runat=&quot;server&quot;&gt;<br /><br />&lt;h2&gt;W3Schools&lt;/h2&gt;<br />&lt;form runat=&quot;server&quot;&gt;<br />&lt;asp:TextBox id=&quot;textbox1&quot; runat=&quot;server&quot; /&gt;<br />&lt;asp:Button id=&quot;button1&quot; runat=&quot;server&quot; text=&quot;Button&quot; /&gt;<br />&lt;/form&gt;<br />
&lt;/asp:Content&gt;
</pre>
</td></tr>
</table>
<p>The content page above demonstrates how .NET controls can be inserted into 
the content page just like an into an ordinary page.</p>
<p><a target="_blank" href="mypage2.aspx">Click to display mypage2.aspx.</a></p>


<hr />
<a href="aspnet_newfeatures.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" /></a>
<a href="aspnet_navigation.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -