在ASP.NET 2.0中,没有专门的页面导航控件,但可以使用SITEMAPdatasource配和DATALIST来实现。
SITEMAPDATASOURCE控件中,需要特别的建立一个web.sitemap的XML文件,该文件中存贮网站的结构,
比如
<?xml version="1.0" encoding="utf-8" ?>
http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
之后,在default.aspx中,写入代码:
protected void Page_Load()
{
int index = -1;
Int32.TryParse(Request.QueryString["id"], out index);
Tabs.SelectedIndex = index;
}
http://www.w3.org/1999/xhtml" >
Untitled Page
a
{
color: #000000;
text-decoration: none;
}
.myTab
{
background: #6666ff;
padding: 4px;
}
.myTabSelected
{
background: #ff00ff;
padding: 4px;
}
就可以实现简单的页面导航的效果了
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12639172/viewspace-331000/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12639172/viewspace-331000/