网站导航免费论文 原创论文 论文搜索 原创论文 网学软件 学术大家 资料中心 会员中心 问题解答 原创论文 大学论文导航 设计下载 最新论文 下载排行 原创论文 论文源代码
返回网学首页
网学联系
最新论文 推荐专题 热门论文 素材专题
当前位置: 网学 > 编程文档 > ASP.net > 正文

MigratingfromASP.NET1.xtoASP.NET2.0

来源:http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/12
u have defined the layout, you can use the navigational structure in many different ways.

a logical structure can be created in two easy steps:

  1. Create an XML file named web.sitemap that lays out the pages of the site in a hierarchical fashion. Visual Studio 2005 allows you to create new .sitemap files ("Add New Item" and select the sitemap template), and also provides IntelliSense support when editing sitemap files.
    <?xml version="1.0" encoding="utf-8" ?> <siteMap>   <siteMapNode title="Home" url="default.aspx">          <siteMapNode title="Article 1"              url="~/articles/demoarticle1.aspx" />          <siteMapNode title="Article 2"              url="~/articles/demoarticle2.aspx" />   <siteMapNode title="Article 3"         url="~/articles/demoarticle3.aspx" />   </siteMapNode>   <siteMapNode title="Picture Gallery"       url="~/PhotoAlbum/PhotoAlbums.aspx">          <siteMapNode title="Meetings"             url="~/PhotoAlbum/PictureAlbum.aspx?albumid=1"/>          <siteMapNode title="Activities"            url="~/PhotoAlbum/PictureAlbum.aspx?albumid=2"/>          <siteMapNode title="Training"             url="~/PhotoAlbum/PictureAlbum.aspx?albumid=3"/>   </siteMapNode>   </siteMapNode></siteMap>
  2. Drag a sitemapdatasource control from the Toolbox and drop it on a page. The sitemapdatasource control will automatically bind to the logical site structure contained in the web.sitemap file.

once the sitemapdatasource control is on a page, you can easily bind it to other controls such as the treeview control or the menu control.

<%@ page language="VB" master="~/Mysite.master" %>  <asp:content id="Content1" contentplaceholderid="LeftSideContent">    <H2>Navigation </h2>    <asp:treeview id="Navigation tree" runat="server"         datasourceid="NavSource"/> </asp:content> 

the tree view will display site navigation using a hierarchical view based on the definitions in the app.sitemap file.

Navigation Controls

asp.net 2.0 also introduces a set of navigation controls that can be used with the site navigation service. By using the <asp:treeview> or <asp:menu> controls, you can create a visual navigation structure for your application. The new <asp:sitemappath> control can be used to generate a "bread crumb trail" navigation structure.

figure 8. Bread crumb trail for the Home | Articles | Article 2 page

URL Mapping

another new navigation-related feature in ASP.NET 2.0 is URL mapping. Web sites often require long, complicated, and convoluted URLs (think of an MSDN reference!). If you wanted to hide your URLs in a classical ASP application, you had to write a custom ISAPI handler to pre-process requests. ASP.NET 2.0 adds the URLMapping configuration section to the Web.config file. A developer can define a mapping that hides the real URL by mapping it to a more user friendly URL.

<urlMappings enabled="true">    <add url=	 
			

网学推荐

免费论文

原创论文

设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved 湘ICP备09003080号