473,508 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Still problems with my menu...

Hi again!

now I realy have a problem..

I want om make a menu that expandes like the menu on http://www.eks.as

The menu should expand after a sertain ID in the querystring. The page you
are on should be bold..

The code works fine exept when I pass a ID that belongs to a "child" in the
menu.... Any idea???
here's what I got so far....

<html>
<head>
<title>default.asp</title>
</head>

<body>

<%
' Connection to the database / Datenbankverbindung
Dim ConnectString, conn
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../../Documents and Settings/All
Users/Dokumenter/portal.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
%>

<%DIm ID
ID = Request.Querystring("id") %>
<%
'Henter kategorier
Dim sqlMeny, rsMeny
sqlMeny = "SELECT * FROM Meny ORDER BY ID ASC"
Set rsMeny = Server.CreateObject("ADODB.Recordset")
rsMeny.Open sqlMeny, conn, 3, 3
do until rsMeny.Eof
If rsMeny("parent") = 0 Then
%>
<%= rsMeny("Navn") %><br>
<%
Else
End If
If CInt(rsMeny.Fields("ID").Value) = CInt(ID) Then

'Henter kategorier
Dim sqlUnder, rsUnder
sqlUnder = "SELECT * FROM Meny WHERE Parent = "& rsMeny("id") &" ORDER BY ID
ASC"
Set rsUnder = Server.CreateObject("ADODB.Recordset")
rsUnder.Open sqlUnder, conn, 3, 3
do until rsUnder.Eof
%>

--<%= rsUnder("Navn") %><br>

<%
rsUnder.MoveNext
Loop
Else
End If

%>
<%
rsMeny.MoveNext
Loop
'disconnect
conn.close
Set conn = Nothing
%>

</body>
</html>


Christopher Brandsdal
Norway
Jul 19 '05 #1
1 1717
http://www.aspfaq.com/show.asp?id=2096
Dim sSQL
sSQL="SELECT meny.ID, meny.Navn, meny.Parent, " & _
"meny_1.ID AS ChildID, meny_1.Navn AS ChildNavn, " & _
"meny_1.Parent AS ChildParent " & _
"FROM meny LEFT OUTER JOIN " & _
" meny meny_1 ON meny.ID = meny_1.Parent " & _
"WHERE (meny.Parent = 0)"

'The above sql statement will return all parent rows and their children in
this style......
'ID Navn ParentID ChildID ChildNavn ChildParent
'1 text1 0 3 child1 1
'1 text1 0 4 child2 1
'2 text2 0 5 child3 2
'6 text3 0 <null> <null> <null>
' Connection to the database / Datenbankverbindung
Dim ConnectString, conn
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../../Documents and Settings/All
Users/Dokumenter/portal.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
Dim rsMeny
Set rsMeny=conn.Execute(sSQL)
if not rsMeny.eof then
Dim lngCurrentParentID
Dim bChildBold
Dim bParentBold
Dim lngBoldedID

lngBoldedID=Request.QueryString("id")
lngCurrentParentID=0

Do While not rsMeny.EOF
bChildBold=false
bParentBold=false
if lngBoldedID=rsMeny.Fields("ID") then bParentBold=true
if lngBoldedID=rsMeny.Fields("ChildID") then bChildBold=true

if rsMeny.Fields("ID") <> lngCurrentParentID then
'this is the first or the next parent record
if bParentBold then
Response.write "<b>" & rsMeny.Fields("navn") &
"</b>"
else
Response.write rsMeny.Fields("navn")
end if
lngCurrentParentID=rsMeny.Fields("ID")
end if
if len(rsMeny.Fields("ChildNavn") & "")>0 then
'this child record is not null (or empty string)
if bChildBold then
Response.write "<b>" &
rsMeny.Fields("ChildNavn") & "</b>"
else
Response.write rsMeny.Fields("ChildNavn")
end if
end if

rsMeny.MoveNext
Loop
end if
Set rsMeny=nothing
conn.Close
Set conn=Nothing


"Christopher Brandsdal" <ch***********@c2i.net> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi again!

now I realy have a problem..

I want om make a menu that expandes like the menu on http://www.eks.as

The menu should expand after a sertain ID in the querystring. The page you
are on should be bold..

The code works fine exept when I pass a ID that belongs to a "child" in the menu.... Any idea???
here's what I got so far....

<html>
<head>
<title>default.asp</title>
</head>

<body>

<%
' Connection to the database / Datenbankverbindung
Dim ConnectString, conn
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("../../Documents and Settings/All
Users/Dokumenter/portal.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
%>

<%DIm ID
ID = Request.Querystring("id") %>
<%
'Henter kategorier
Dim sqlMeny, rsMeny
sqlMeny = "SELECT * FROM Meny ORDER BY ID ASC"
Set rsMeny = Server.CreateObject("ADODB.Recordset")
rsMeny.Open sqlMeny, conn, 3, 3
do until rsMeny.Eof
If rsMeny("parent") = 0 Then
%>
<%= rsMeny("Navn") %><br>
<%
Else
End If
If CInt(rsMeny.Fields("ID").Value) = CInt(ID) Then

'Henter kategorier
Dim sqlUnder, rsUnder
sqlUnder = "SELECT * FROM Meny WHERE Parent = "& rsMeny("id") &" ORDER BY ID ASC"
Set rsUnder = Server.CreateObject("ADODB.Recordset")
rsUnder.Open sqlUnder, conn, 3, 3
do until rsUnder.Eof
%>

--<%= rsUnder("Navn") %><br>

<%
rsUnder.MoveNext
Loop
Else
End If

%>
<%
rsMeny.MoveNext
Loop
'disconnect
conn.close
Set conn = Nothing
%>

</body>
</html>


Christopher Brandsdal
Norway

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2371
by: eternalD3 | last post by:
Hi, I have a problem to get this working on Opera 7.x+. This does not need to work on older Opera browsers There are problems on rendering the sub-level navigation. It aligns right on Firefox...
5
3221
by: Aaron | last post by:
I'm having problems getting my popup menu to work correctly, and was hoping someone here could point me in the right direction. I have the following script: <script> var activeMenu=""; ...
4
1504
by: dpomt | last post by:
Hello, I am using the ASP.NET menu control and I have two issues when the page containing the menu is displayed in Safari on Mac OS X: 1) The menu is not dynamic. Why (it seems that Safari is...
3
1203
by: WT | last post by:
I use Menu navigation control in an ascx, the Menu if filled with Menuitems during Load event. Sub-MenuItems are added to the ChildItems collection. But on the display the behavior of menu is...
2
2436
by: travelrats | last post by:
Hi Here's my problem - I've been trying to figure this out for a while and ran out of ideas... <div> id1 contains <div> id2 (a geographical map) <div> id2 contains a context menu made out of...
1
1992
by: proplady | last post by:
I've had this menu for some time, and periodically make changes. I've made some changes now (just some menu items), and the menu will not show up on my webpages. I know it's something simple,...
7
1792
by: joecap5 | last post by:
I have a main window from which I want to open a separate side menu window. I then want to create a list of items on that side menu by clicking on the item names in the main window. So far I am...
3
2193
by: =?ISO-8859-1?Q?Jo=E3o_Maia?= | last post by:
Hi there, I am having a weird problem in trying to use a ASP.NET menu inside a custom web part. I am developing a custom web part that has a menu inside (just the menu, nothing else). The menu...
0
1140
by: COHENMARVIN | last post by:
I have a page that has a menu running down the left side. When I load a wide gridview into the page, that gridview doesn't fit to the right of the menu. So it gets moved below the menu. I tried...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1561
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
767
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
422
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.