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

📄 aspnet_navigation.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 Navigation</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 - Navigation</h1>
<a href="aspnet_masterpages.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" /></a>
<a href="aspnet_refhtmlcontrols.asp"><img alt="next" border="0" src="../images/btn_next.gif" /></a>
<hr />
<p class="intro">ASP.NET 2.0 has built-in navigation controls</p>
<hr />

<h2>Web Site Navigation</h2>
<p>Maintaining the menu of a large web site is difficult and time consuming.</p>
<p>In ASP.NET 2.0 the menu can be stored in a file to make it easier 
to maintain. This file is normally called <b>web.sitemap</b>, and is stored in 
the root directory of the web.</p>
<p>In addition, ASP.NET 2.0 has three new navigation controls:</p>
<ul>
	<li>Dynamic menus</li>
	<li>TreeViews</li>
	<li>Site Map Path</li>
</ul>
<hr />

<h2>The Sitemap File</h2>
<p>The following sitemap file is used in 
this tutorial:</p>

<table border="1" width="100%" class="ex" cellspacing="0" id="table3">
<tr><td>
<pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?&gt;
&lt;siteMap&gt;
  &lt;siteMapNode title=&quot;Home&quot; url=&quot;/aspnet/w3home.aspx&quot;&gt;
  &lt;siteMapNode title=&quot;Services&quot; url=&quot;/aspnet/w3services.aspx&quot;&gt;
    &lt;siteMapNode title=&quot;Training&quot; url=&quot;/aspnet/w3training.aspx&quot;/&gt;
    &lt;siteMapNode title=&quot;Support&quot; url=&quot;/aspnet/w3support.aspx&quot;/&gt;
  &lt;/siteMapNode&gt;
  &lt;/siteMapNode&gt;
&lt;/siteMap&gt;</pre>
</td></tr>
</table>
<p>Rules for creating a sitemap file:</p>
<ul>
	<li>The XML file must contain a &lt;siteMap&gt; tag surrounding the content</li>
	<li>The &lt;siteMap&gt; tag can only have one &lt;siteMapNode&gt; child node 
	(the &quot;home&quot; page)</li>
	<li>Each &lt;siteMapNode&gt; can have several child nodes (web pages)</li>
	<li>Each &lt;siteMapNode&gt; has attributes defining page title and 
	URL</li>
</ul>
<p><img border="0" src="../images/lamp.gif" width="15" height="15" alt="lamp" /> 
<b>Note:</b> The sitemap file must be placed in the root directory of the web and the 
URL attributes must be relative to the root directory.</p>


<hr />

<h2>Dynamic Menu</h2>
<p>The &lt;asp:Menu&gt; control displays a standard site 
navigation menu. </p>
<p><b>Code Example:</b></p>

<table border="1" width="100%" class="ex" cellspacing="0" id="table8">
<tr><td>
<pre>&lt;asp:SiteMapDataSource id=&quot;nav1&quot; runat=&quot;server&quot; /&gt;</pre>
<pre>&lt;form runat=&quot;server&quot;&gt;
&lt;asp:Menu runat=&quot;server&quot; DataSourceId=&quot;nav1&quot; /&gt;
&lt;/form&gt;</pre>
</td></tr>
</table>
<p>The <b>&lt;asp:Menu&gt;</b> control in the example above is a placeholder for a 
server created navigation menu.</p>
<p>The data source of the control is defined by the <b>DataSourceId</b> attribute. 
The <b>id=&quot;nav1&quot;</b> connects it to the&nbsp; <b>&lt;asp:SiteMapDataSource&gt;</b> control.</p>
<p>The <b>&lt;asp:SiteMapDataSource&gt;</b> control automatically connects to 
the default sitemap file (<b>web.sitemap</b>).</p>


<p><a target="_blank" href="w3services.aspx">Click here to see a demo of Menu, 
TreeView, and SiteMapPath</a></p>


<hr />

<h2>TreeView</h2>
<p>The &lt;asp:TreeView&gt; control displays a multi level navigation menu.</p>
<p>The menu looks like a tree with branches that can be opened or closed with + 
or - symbol. </p>
<p><b>Code Example:</b></p>

<table border="1" width="100%" class="ex" cellspacing="0" id="table6">
<tr><td>
<pre>&lt;asp:SiteMapDataSource id=&quot;nav1&quot; runat=&quot;server&quot; /&gt;</pre>
<pre>&lt;form runat=&quot;server&quot;&gt;
&lt;asp:TreeView runat=&quot;server&quot; DataSourceId=&quot;nav1&quot; /&gt;
&lt;/form&gt;</pre>
</td></tr>
</table>
<p>The <b>&lt;asp:TreeView&gt;</b> control in the example above is a placeholder for a 
server created navigation menu.</p>
<p>The data source of the control is defined by the <b>DataSourceId</b> attribute. 
The <b>id=&quot;nav1&quot;</b> connects it to the&nbsp; <b>&lt;asp:SiteMapDataSource&gt;</b> control.</p>
<p>The <b>&lt;asp:SiteMapDataSource&gt;</b> control automatically connects to 
the default sitemap file (<b>web.sitemap</b>).</p>


<p><a target="_blank" href="w3services.aspx">Click here to see a demo of Menu, 
TreeView, and SiteMapPath</a></p>


<hr />

<h2>SiteMapPath</h2>
<p>The SiteMapPath control displays the trail (navigation path) to the current 
page. The path acts as clickable links to previous pages.</p>
<p>Unlike the TreeView and Menu control the SiteMapPath control does <b>NOT</b> use 
a SiteMapDataSource. The SiteMapPath control uses the web.sitemap file by default.</p>
<p><img border="0" src="../images/lamp.gif" width="15" height="15" alt="lamp" /> 
Tips: If the SiteMapPath displays incorrectly, most likely there is an URL error 
(typo) in the web.sitemap file.</p>
<p><b>Code Example:</b></p>

<table border="1" width="100%" class="ex" cellspacing="0" id="table7">
<tr><td>
<pre>&lt;form runat=&quot;server&quot;&gt;
&lt;asp:SiteMapPath runat=&quot;server&quot; /&gt;
&lt;/form&gt;</pre>
</td></tr>
</table>
<p>The <b>&lt;asp:SiteMapPath&gt;</b> control in the example above is a placeholder for a 
server created site path display.</p>


<p><a target="_blank" href="w3services.aspx">Click here to see a demo of Menu, 
TreeView, and SiteMapPath</a></p>


<hr />
<a href="aspnet_masterpages.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" /></a>
<a href="aspnet_refhtmlcontrols.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 + -