Click to See Complete Forum and Search --> : Active / Current page navigation?


ttbarnes
06-28-2010, 07:57 AM
Hi all,

I am fairly new to ASP.NET so please bare with me..

I am building a site and I would like to be able to style a navigation button / link for 'active' pages, being the current page that you are on.

Obviously, The 'disbaled' pages that you are not currently viewing would return to the default styling.

I believe that this would involve xml, xslt and asp.net, and i'm new to all of these.

Please let me know if I need to ellaborate more on this. A point in the right direction would be most appreciated as I really want to learn and develop this.

Thank you for your time,

Tony.

MikeOS
07-21-2010, 07:23 PM
I'd suggest you check out the menu control and the SiteMapDataSource controls, they can do all the work for you. Basically you create your navigation within a Web.sitemap file (look online for examples), then drop a SiteMapDataSource control into your page remembering to give it an ID, then you drop a menu control into the page and set its DataSourceID property to the ID you gave to the SiteMapDataSource. Now using the StaticSelectedStyle element of the menu control you can set styles for the current page link being view to whatever you like.

You could also use CSS descendant selectors to style the current page link in the navigation, typically you set an id on the body tag that is different for each page and use this with the element containing your links, typically a ul element, to set the link style for each page.

ttbarnes
08-06-2010, 07:03 AM
Thanks for the reply Mike, appreciated.

I'll give that a go. The last paragraph that you wrote mentioned adding id's to body tags - I know this method, but this cannot be used in ASP.NET using master and content pages..

Thank you again :D