15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1200 ❘ ChaPTer 41 Asp.net feAtures<br />

The data from this data source is consumed by Menu <strong>and</strong> TreeView controls simply by setting their<br />

DataSourceID to the ID of the SiteMapDataSource. Both controls include numerous styling properties<br />

<strong>and</strong> can be themed, as you see later in this chapter.<br />

navigating in PCsdemosite<br />

The site map for PCSDemoSite is as follows:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

code snippet PCSDemoSite/Web.sitemap<br />

The PCSDemoSite web site uses a custom provider to obtain information from Web.sitemap — which<br />

is necessary because the default provider ignores the roles attributes. The provider is defined in the<br />

web.config file for the web site as follows:<br />

<br />

<br />

<br />

<br />

<br />

code snippet PCSDemoSite/web.config<br />

The only difference between this <strong>and</strong> the default provider is the addition of securityTrimmingEnabled=<br />

“true”, which instructs the provider to supply data for just those nodes that this current user is allowed to<br />

see. This visibility is determined by the role membership of the user, as you see in the next section.<br />

The MasterPage.master page in PCSDemoSite includes SiteMapPath <strong>and</strong> TreeView navigation displays<br />

along with a data source, as follows:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!