ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 21st, 2002, 08:24 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Database Driven Menu with ASP which is Expandable/Collapsable

Can anyone tell me how to create a dynamic database-driven menu, which is expandable and collapsable using ASP.

I have seen it done with PHP (article on devarticles). I have also seen a version in ASP using a folder tree structure, but I haven't come across code to create one that is based on ASP and is database driven.

Any advice would be greatly appreciated!

Reply With Quote
  #2  
Old August 21st, 2002, 07:34 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
how much asp do you know?

Reply With Quote
  #3  
Old August 21st, 2002, 09:33 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
I'd say I'm about an intermediate level.

In fact, I was just going through Annette's article on creating the database driven menu system with PHP and I think I can translate most of it to ASP except for the following:

Code:
<img id="img_root_<?php echo $counter; ?>" 
onClick="ToggleNode(td_root_<?php echo $counter; ?>, 
img_root_<?php echo $counter; ?>)" border="0" 
src="minus.gif" style="cursor:hand">

<!php echo $node[1]; ?>


If any of you multilingular people could let me know how that would appear in ASP, I would be extremely grateful!

Reply With Quote
  #4  
Old August 21st, 2002, 10:05 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Okay, I'm looking over your php basics tutorial and I think that:

<?php echo $counter; ?>

is probably the equivalent of <%=counter%> or Response.Write Counter. Am I right?

Now how about the <?php echo $node[1]; ?>?

Is that the same as <%=myRS("title")%> or Response.Write myRS("Title") (assuming that [1] corresponds with the "title" column)?

Reply With Quote
  #5  
Old August 21st, 2002, 10:52 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
that looks right, then again, i dont know asp, so i might be totally off

Reply With Quote
  #6  
Old August 22nd, 2002, 04:06 PM
markerdave markerdave is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Illinois, USA
Posts: 71 markerdave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Post

<?php echo $counter; ?> is equivalent to <%=counter%> in ASP so if you replace everything as you have suggested, you should get what you are looking for. Can you respond back here if you get it working okay? I am interested in knowing how hard or easy it is.

Reply With Quote
  #7  
Old August 23rd, 2002, 10:14 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
One more question: how does counter++ translate into asp? is that like counter + 1?

Reply With Quote
  #8  
Old August 23rd, 2002, 11:46 AM
markerdave markerdave is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Illinois, USA
Posts: 71 markerdave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
In PHP and several other languages counter++ is used as a post-increment operator. It gives you the value of counter and then increases it by one. Used alone counter++ would be equivalent to counter = counter + 1 with ASP. When changing it over to ASP there are times you need to be careful.

For example, in the PHP code:

<?php echo counter++; ?>

would be the same as ASP

Response.Write counter
counter = counter + 1

and not

counter = counter + 1
Response.Write counter

Just make sure that with post-increments (variable++) you use the variable and then increase it by one and with pre-increments (++variable) you increase it by one and then use it.

Reply With Quote
  #9  
Old August 23rd, 2002, 02:33 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
I think I am very close to getting this to work but I'm having three (perhaps interrelated?) problems:

1. I keep getting a javascript error telling me that td_root_0 is undefined;

2. The expanded list is emerging when I load the file - I want it to appear collapsed on load; and

3. When I click on the minus button it collapses the item above instead of the menu item I clicked on.

Can anyone assist? Here's the file. Thanks!
Attached Files
File Type: txt tiptree3.txt (2.3 KB, 529 views)

Reply With Quote
  #10  
Old August 23rd, 2002, 02:46 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Okay, thanks to markerdave 's suggestion, I have changed where the counter +1 appears to put it below the <td id>. That change seems to solve my problems 1. and 3. However, my menu is still appearing expanded on load instead of collapsed! Help!

Reply With Quote
  #11  
Old August 24th, 2002, 11:34 AM
markerdave markerdave is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Illinois, USA
Posts: 71 markerdave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Post

The php code was written to have the menu expanded when the page loaded. To change this, where you have

<td id="td_root_<%=counter%>" class="child_td">

add a style attribute

style=" display='none' "

That should make it load collapsed instead. Also, don't forget to change your minus.gif to plus.gif in the img tag so the right picture loads. Hope this helps!

Reply With Quote
  #12  
Old August 25th, 2002, 09:57 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Post

Worked like a charm! Thanks so much markerdave

Reply With Quote
  #13  
Old August 27th, 2002, 09:58 AM
DavidM DavidM is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 78 DavidM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Would you mind posting the ASP code. I'd be interested in looking at it.

Thanks!

Reply With Quote
  #14  
Old August 27th, 2002, 02:06 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Here it is. I changed it slightly to suit the needs of my database.

If anyone can come up with a function to allow for the menu to drill deeper than two levels, please let me know.
Attached Files
File Type: txt tiptree3.txt (2.3 KB, 971 views)

Reply With Quote
  #15  
Old July 13th, 2005, 11:29 AM
remarkable remarkable is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 1 remarkable User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 7 sec
Reputation Power: 0
need dbconn.asp

Quote:
Originally Posted by aspnewbie
Here it is. I changed it slightly to suit the needs of my database.

If anyone can come up with a function to allow for the menu to drill deeper than two levels, please let me know.


I need a copy of your dbconn.asp, so I can see how to make the database connection...thanks much.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Database Driven Menu with ASP which is Expandable/Collapsable


Developer Shed Advertisers and Affiliates


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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap