In this article you will learn about SiteMap implementation.
- Create a new ASP.NET Empty Web Application,
![new]()
![new]()
- Add a new Web Form named Home.aspx,
![Home]()
- Add new Web Form named ProductGroups.aspx,
![ProductGroups]()
- Add a new Web Form named PlasticItems.aspx,
![PlasticItems]()
- Add a new Web Form named Furniture.aspx
![Furniture]()
- Add a new Web Form named AboutUs.aspx
![AboutUs]()
- Add a new Web Form named ContactUs.aspx,
![ContactUs]()
Till now, we added the following WebForm files,
1. AboutUs.aspx
2. ContactUs.aspx
3. Furnitures.aspx
4. Home.aspx
5. PlasticItems.aspx
6. ProductGroups.aspx
- Add Sitemap file. Right click on Project and select,
![Sitemap]()
- Double on Web.sitemap file type the following code:
- <?xmlversionxmlversion="1.0"encoding="utf-8" ?>
- <siteMapxmlnssiteMapxmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
-
- <siteMapNodeurlsiteMapNodeurl="Home.aspx" title="Home" description="Home Page">
-
- <siteMapNodeurlsiteMapNodeurl="ProductGroups.aspx" title="Product Group" description="Product Group Page">
- <siteMapNodeurlsiteMapNodeurl="Furnitures.aspx" title="Furnitures" description="Furniture Items Page" />
- <siteMapNodeurlsiteMapNodeurl="PlasticItems.aspx" title="Plastics" description="Plastic Items Page" />
- </siteMapNode>
-
- <siteMapNodeurlsiteMapNodeurl="Aboutus.aspx" title="About Us" description="About Us Page" />
- <siteMapNodeurlsiteMapNodeurl="Contactus.aspx" title="Contact Us" description="Contact Us Page" />
-
- </siteMapNode>
- </siteMap>
- Explanation of Web.sitemap code
Web.sitemap is XML base file.
In this file there is one main SiteMapNode that is HOME - Home.aspx. Under that we have the following two sections :
1. ProductGroup section -- (ProductGroups.aspx) having following child link:
a. Furniture.aspx
b. PlasticItems.aspx
2. Two Independent Page.
a. AboutUs.aspx
b. ContactUs.apx
- Now, Drag and Drop the SiteMapPath control from ToolBox inside Navigation group,
Inside following files,
1. AboutUs.aspx
2. ContactUs.aspx
3. Furnitures.aspx
4. Home.aspx
5. PlasticItems.aspx
6. ProductGroups.aspx
![navigation]()
Write some sample text in every page:
PAGE NAME | SAMPLE TEXT |
AboutUs.aspx : | This is About Us detail page. |
ContactUs.aspx | This is Contact Us detail page. |
Furnitures.aspx | This is Furnituresdetail page. |
Home.aspx | This is Home detail page. |
PlasticItems.aspx | This is Plastic Items detail page. |
ProductGroups.aspx | This is Product Groups detail page. |
- Now run application. I had typed Furniture.aspx in address bar.
You can see furnitures.aspx page shown. You came here via Home, Product Group, Furnitures. That’s sitemap!. Next article I will explain TreeView and Menu.