ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old April 28th, 2008, 07:53 AM
desktop_doodle desktop_doodle is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 21 desktop_doodle User rank is Corporal (100 - 500 Reputation Level)desktop_doodle User rank is Corporal (100 - 500 Reputation Level)desktop_doodle User rank is Corporal (100 - 500 Reputation Level)desktop_doodle User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 7 h 11 m 41 sec
Reputation Power: 0
Asp dynamically created pages - need to set menu items as 'active'

Hi,

I have a series of dynamically created HTML pages. This query relates to the menu - my issue is that I need to set the 'a:active' state for the relevant menu items to show the current page, but as the pages are dynamicallly created, not static I'm not sure how I can go about doing this.

The menu is defined in a menu.ascx file, and then called into each of the HTML pages using asp.

Just to clarify - Ordinarily, on static pages you would have something like:

<div id="menu" class="menu">
<menu id="active" href="someurl">HOME</a>
<menu id="inactive" href="someurl">ABOUT US</a>
</div>

or

<div class="menu">
<ul>
<li id="active" href="someurl">HOME</li>
<li id="inactive" href="someurl">ABOUT US</li>
</ul>
</div>

And then the home page (for example) would show a different icon to the rest of the menu -as defined by CSS (.menu active/inactive).

Each page would have a different 'active' menu item - however as these are not static pages - I am unable to do that.

Using a:visited would make every menu item show the 'current' icon -and once it had been viewed - it would never return to the original state

I was thinking that I would be able to use some sort of script in the head to facilitate this need - something like:

if pageID = 459
then menu id 'home' = active

(or something akin to that)
-and then go through the seperate menu items/pages.

I think some sort of script would be the only viable solution - although I could be wrong as I'm unfamiliar with Asp - any help please?

Many many thaks in advance!

Mike

Reply With Quote
  #2  
Old May 12th, 2008, 04:52 PM
tkadlec tkadlec is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 9 tkadlec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 15 sec
Reputation Power: 0
You could check the URL of the page with VBScript using something like so:

Code:
Thispage = Request.ServerVariables("script_name")
pageName = Split(thispage, "/")


Then perform the check inline on each link like so:

Code:
<a <% If pageName(1) = "thispage.asp" Then %> class="active" <% End If %>href="thisPage.asp">This Page</a>


Simple but it works...

Tim

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Asp dynamically created pages - need to set menu items as 'active'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway