QA


Q&A

Q1:

Why does ASP.NET require that the site map be expressed as a particularly formatted XML file? What if I already have a database or my own custom XML file with site structure information? Or what if I want the site map to be based on my website's folder structure and don't want to have to bother with mirroring the folder structure in the site map file? Does that mean I can't use the ASP.NET navigation controls?

A1:

Actually, ASP.NET allows for developers to specify their own site map formats. You can create your own site map provider that would allow for a different mechanism for storing the site map information. A site map provider is a class that you would write to instruct ASP.NET on how to retrieve site map information. The default site map provider uses an XML file with the format we examined in this hour; however, there's no reason why you couldn't create your own provider.

A discussion on creating and working with custom providers is beyond the scope of this book. If you are interested in learning more, though, be sure to check out the articles at http://msdn.microsoft.com/library/en-us/dnaspp/html/extndsitenv.asp and http://msdn.microsoft.com/library/en-us/dnaspp/html/custsitemap.asp.

Q2:

In this chapter we added various navigation controls to various pages. If I want the Menu or SiteMapPath control to exist on all pages in my site, must I manually go to each page and add the appropriate controls, or is there a better way?

A2:

When creating a website, typically we want all pages to have a similar look and feel, such as all pages having a menu across the top. A naïve way to accomplish this is to simply repeat the desired look and feel on each page. This approach, though, is asking for trouble, because if we decide to update our site's look, we then need to make changes to each and every page in the site!

A better approach is to use master pages. Master pages allow us to create a single page that specifies a standard look and feel. For example, the master page may contain a menu along the top and a list of common links at the bottom of the page. Then, when creating a new page, we can specify that it use the master page. The result is that all pages that use the master page will have a consistent look and feel. Furthermore, any changes to the master page are immediately reflected on those pages that use that master page, thereby making updating the site's appearance as easy as editing the master page.

We'll examine master pages in depth in Hour 21, "Using Master Pages to Provide Sitewide Page Templates."




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net