Forums
This topic is locked
help with related menus and record display
Posted 12 Apr 2006 19:14:07
1
has voted
12 Apr 2006 19:14:07 Javier Castro posted:
Hi,I have this problem that is driving me insane.
My main menu(vertical on the left side of the page) with about 18 items(of categories ) passes the parameter cat when you click on one of the items
<pre id=code><font face=courier size=2 id=code>
<%
Dim rsCats__MMColParam
rsCats__MMColParam = "True"
If (Request("MM_EmptyValue" <> "" Then
rsCats__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsCats__MMColParam1
rsCats__MMColParam1 = "%"
If (Request.QueryString("cat" <> "" Then
rsCats__MMColParam1 = Request.QueryString("cat"
End If
%>
<%
Dim rsCats
Dim rsCats_numRows
Set rsCats = Server.CreateObject("ADODB.Recordset"
rsCats.ActiveConnection = MM_connProducts_STRING
rsCats.Source = "SELECT bitShow, intProdCatID, intSort, txtLink, txtProdCat FROM tblProdCat WHERE bitShow = " + Replace(rsCats__MMColParam, "'", "''" + " AND intProdCatID LIKE '" + Replace(rsCats__MMColParam1, "'", "''" + "' ORDER BY txtProdCat ASC"
rsCats.CursorType = 0
rsCats.CursorLocation = 2
rsCats.LockType = 1
rsCats.Open()
rsCats_numRows = 0
%>
<%
' Dims commented out because give an error if uncommented
'Dim Repeat1__numRows
'Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsCats_numRows = rsCats_numRows + Repeat1__numRows
%>
<div id="menu">
<div align="right">
<%
While ((Repeat1__numRows <> 0) AND (NOT rsCats.EOF))
%>
<a href="edward/canbuilt2006v01/home.asp?cat=<%=(rsCats.Fields.Item("intProdCatID".Value)%>"><%=(rsCats.Fields.Item("txtProdCat".Value)%></a>
<a href="edward/canbuilt2006v01/">
<img src="edward/canbuilt2006v01/body_images/white/arrow.gif" width="15" height="15" border="0" align="absmiddle" style="margin-bottom:2px; ">
</a><br />
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsCats.MoveNext()
Wend
%>
</div>
</div>
<%
rsCats.Close()
Set rsCats = Nothing
%>
</font id=code></pre id=code>
then the appropriate submenu (of subcategories) appearshorizontally and on the top right of the page.
<pre id=code><font face=courier size=2 id=code>
<%
Dim rsSubCats__MMColParam
rsSubCats__MMColParam = "True"
If (Request("MM_EmptyValue" <> "" Then
rsSubCats__MMColParam = Request("MM_EmptyValue"
End If
%>
<%
Dim rsSubCats__MMColParam1
rsSubCats__MMColParam1 = "0"
If (Request.QueryString("cat" <> "" Then
rsSubCats__MMColParam1 = Request.QueryString("cat"
End If
%>
<%
Dim rsSubCats
Dim rsSubCats_numRows
Set rsSubCats = Server.CreateObject("ADODB.Recordset"
rsSubCats.ActiveConnection = MM_connProducts_STRING
rsSubCats.Source = "SELECT tblProdSubcat.bitShow, intPCatID, intPSubCatID, txtSubCatName, intProdCatID FROM tblProdSubcat, tblProdCat WHERE tblProdSubcat.bitShow = " + Replace(rsSubCats__MMColParam, "'", "''" + " AND intPCatID = intProdCatID AND intPCatID LIKE '" + Replace(rsSubCats__MMColParam1, "'", "''" + "' ORDER BY intPSubCatID ASC"
rsSubCats.CursorType = 0
rsSubCats.CursorLocation = 2
rsSubCats.LockType = 1
rsSubCats.Open()
rsSubCats_numRows = 0
%>
<div align="right">
<%
While ((Repeat2__numRows <> 0) AND (NOT rsSubCats.EOF))
%>
<a href="edward/canbuilt2006v01/home.asp?subcat=<%=(rsSubCats.Fields.Item("intPSubCatID".Value)%>&cat=<%= Request.QueryString("cat" %>"><%=(rsSubCats.Fields.Item("txtSubCatName".Value)%></a>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsSubCats.MoveNext()
Wend
%>
</div>
<%
rsSubCats.Close()
Set rsSubCats = Nothing
%>
</font id=code></pre id=code>
all the main menu categories affect the submenu items properly, the problem is that when I click in any main menu, and the submenu comes up, the body should display the first record of the first subcategory as a default, but it doesn't it is always blank. However, when you click the submenu the appropriate record is displayed.
I tried adding another parameter to my main category but it gives me more errors than anything.
I hope I explained it properly.
The following code is where of the body where the content should come up. Please, help, it is driving me crazy......
[CODE]
<%
Dim rsProducts__MMColParam
rsProducts__MMColParam = "0"
If (Request.QueryString("subcat" <> "" Then
rsProducts__MMColParam = Request.QueryString("subcat"
End If
%>
<%
Dim rsProducts__MMColParam1
rsProducts__MMColParam1 = "True"
If (Request("MM_EmptyValue" <> "" Then
rsProducts__MMColParam1 = Request("MM_EmptyValue"
End If
%>
<%
Dim rsProducts
Dim rsProducts_numRows
Set rsProducts = Server.CreateObject("ADODB.Recordset"
rsProducts.ActiveConnection = MM_connProducts_STRING
rsProducts.Source = "SELECT intSCatID, textProdName, txtProdCode, memDescription, txtImagename, intPSubCatID FROM tblProds, tblProdSubcat WHERE intSCatID LIKE '" + Replace(rsProducts__MMColParam, "'", "''" + "' AND intSCatID = intPSubCatID AND tblProds.bitShow = " + Replace(rsProducts__MMColParam1, "'", "''" + " ORDER BY intSCatID ASC"
rsProducts.CursorType = 0
rsProducts.CursorLocation = 2
rsProducts.LockType = 1
rsProducts.Open()
rsProducts_numRows = 0
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
rsSubCats_numRows = rsSubCats_numRows + Repeat2__numRows
%>
<%
Dim Repeat3__numRows
Dim Repeat3__index
Repeat3__numRows = -1
Repeat3__index = 0
rsProducts_numRows = rsProducts_numRows + Repeat3__numRows
%>
<%
Dim rsSubCat__MMColParam1
rsSubCat__MMColParam1 = "0"
If (Request.QueryString("id" <> "" Then
rsSubCat__MMColParam1 = Request.QueryString("id"
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<title>Sayco/Canbuilt - Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style5.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!--#include file="inc/header.asp"-->
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="18" background="body_images/white/bar_left_gray.jpg" scope="row"></th>
<td bgcolor="#656565"><div id="page_title">
<h2>Welcome</h2>
</div>
<div id="navsubcat">
<!--#include file="inc/submenu.asp"-->
</div>
</div>
</td>
<td width="18" height="35" background="body_images/white/bar_right_gray.jpg"> </td>
</tr>
</table>
<table width="80%" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td width="18" rowspan="2" background="body_images/white/bar_left.jpg"><img src="body_images/white/pixel.gif" width="1" height="1" /></td>
<td width="150" bgcolor="#CCCCCC"></td>
<td colspan="2" rowspan="2" valign="top" bgcolor="#CCCCCC"><div id="body_shell" style="padding:5px; background-color:white; border:1px dashed #333333; margin-left: 5px; margin-top: 5px;">
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<%
While ((Repeat3__numRows <> 0) AND (NOT rsProducts.EOF))
%>
<tr>
<th colspan="2" scope="row"><div align="left" style="background-color:#CCCCCC; border-bottom:2px solid red; "><%=(rsProducts.Fields.Item("txtProdCode".Value)%><br />
<%=(rsProducts.Fields.Item("textProdName".Value)%> </div> <div align="left"></div></th>
</tr>
<tr>
<th scope="row"><div align="left"></div></th>
<td width="200" rowspan="2"><div align="left"></div>
<div align="left"><img name="" src="<%=(rsProducts.Fields.Item("txtImagename".Value)%>" alt="" /></div></td>
</tr>
<tr>
<th valign="top" scope="row"><div align="left"><%=(rsProducts.Fields.Item("memDescription".Value)%></div></th>
</tr>
<tr>
<th scope="row"><div align="left"></div></th>
<td width="200"><div align="left"></div></td>
</tr>
<%
Repeat3__index=Repeat3__index+1
Repeat3__numRows=Repeat3__numRows-1
rsProducts.MoveNext()
Wend
%>
</table>
<p> </p>
<p> </p>
<p><br />
<br />
</p>
<p> </p>
</div></td>
<td width="18" rowspan="2" background="body_images/white/bar_right.jpg"><img src="body_images/white/pixel.gif" width="1" height="1" /></td>
</tr>
<tr>
<td width="190" valign="top" bgcolor="#CCCCCC"><div id="menu">
<!--#include file="inc/nav.asp"-->
<div align="right"></div>
</div></td>
</tr>
<tr>
<td width="18"><div align="right"><img src="body_images/white/corner_left_bottom.jpg" width="18" height="18" /></div></td>
<td colspan="3" background="body_images/white/bar_bottom.jpg" bgcolor="#CCCCCC"><img src="body_images/white/pixel.gif" width="1" height="1" /></td>
<td width="18"><img src="body_images/white/corner_right_bottom.jpg" width="18" height="18" /></td>
</tr>
</table>
</html>
<%
rsProducts.Close()
Set rsProducts = Nothing
%>
[CODE]