Forums

ASP

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>
&lt;%
Dim rsCats__MMColParam
rsCats__MMColParam = "True"
If (Request("MM_EmptyValue" &lt;&gt; "" Then
rsCats__MMColParam = Request("MM_EmptyValue"
End If
%&gt;
&lt;%
Dim rsCats__MMColParam1
rsCats__MMColParam1 = "%"
If (Request.QueryString("cat" &lt;&gt; "" Then
rsCats__MMColParam1 = Request.QueryString("cat"
End If
%&gt;
&lt;%
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
%&gt;
&lt;%
' 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
%&gt;
&lt;div id="menu"&gt;
&lt;div align="right"&gt;
&lt;%
While ((Repeat1__numRows &lt;&gt; 0) AND (NOT rsCats.EOF))
%&gt;
&lt;a href="edward/canbuilt2006v01/home.asp?cat=&lt;%=(rsCats.Fields.Item("intProdCatID".Value)%&gt;"&gt;&lt;%=(rsCats.Fields.Item("txtProdCat".Value)%&gt;&lt;/a&gt;
&lt;a href="edward/canbuilt2006v01/"&gt;
&lt;img src="edward/canbuilt2006v01/body_images/white/arrow.gif" width="15" height="15" border="0" align="absmiddle" style="margin-bottom:2px; "&gt;
&lt;/a&gt;&lt;br /&gt;
&lt;%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsCats.MoveNext()
Wend
%&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;%
rsCats.Close()
Set rsCats = Nothing
%&gt;

</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>

&lt;%
Dim rsSubCats__MMColParam
rsSubCats__MMColParam = "True"
If (Request("MM_EmptyValue" &lt;&gt; "" Then
rsSubCats__MMColParam = Request("MM_EmptyValue"
End If
%&gt;
&lt;%
Dim rsSubCats__MMColParam1
rsSubCats__MMColParam1 = "0"
If (Request.QueryString("cat" &lt;&gt; "" Then
rsSubCats__MMColParam1 = Request.QueryString("cat"
End If
%&gt;
&lt;%
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
%&gt;

&lt;div align="right"&gt;
&lt;%
While ((Repeat2__numRows &lt;&gt; 0) AND (NOT rsSubCats.EOF))
%&gt;
&lt;a href="edward/canbuilt2006v01/home.asp?subcat=&lt;%=(rsSubCats.Fields.Item("intPSubCatID".Value)%&gt;&cat=&lt;%= Request.QueryString("cat" %&gt;"&gt;&lt;%=(rsSubCats.Fields.Item("txtSubCatName".Value)%&gt;&lt;/a&gt;
&lt;%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
rsSubCats.MoveNext()
Wend
%&gt;
&lt;/div&gt;
&lt;%
rsSubCats.Close()
Set rsSubCats = Nothing
%&gt;
</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]

&lt;%
Dim rsProducts__MMColParam
rsProducts__MMColParam = "0"
If (Request.QueryString("subcat" &lt;&gt; "" Then
rsProducts__MMColParam = Request.QueryString("subcat"
End If
%&gt;
&lt;%
Dim rsProducts__MMColParam1
rsProducts__MMColParam1 = "True"
If (Request("MM_EmptyValue" &lt;&gt; "" Then
rsProducts__MMColParam1 = Request("MM_EmptyValue"
End If
%&gt;
&lt;%
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
%&gt;
&lt;%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = -1
Repeat2__index = 0
rsSubCats_numRows = rsSubCats_numRows + Repeat2__numRows
%&gt;
&lt;%
Dim Repeat3__numRows
Dim Repeat3__index

Repeat3__numRows = -1
Repeat3__index = 0
rsProducts_numRows = rsProducts_numRows + Repeat3__numRows
%&gt;
&lt;%
Dim rsSubCat__MMColParam1
rsSubCat__MMColParam1 = "0"
If (Request.QueryString("id" &lt;&gt; "" Then
rsSubCat__MMColParam1 = Request.QueryString("id"
End If
%&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;title&gt;Sayco/Canbuilt - Home&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;link href="style5.css" rel="stylesheet" type="text/css" /&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;!--#include file="inc/header.asp"--&gt;

&lt;table width="80%" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
&lt;tr&gt;
&lt;th width="18" background="body_images/white/bar_left_gray.jpg" scope="row"&gt;&lt;/th&gt;
&lt;td bgcolor="#656565"&gt;&lt;div id="page_title"&gt;



&lt;h2&gt;Welcome&lt;/h2&gt;

&lt;/div&gt;
&lt;div id="navsubcat"&gt;
&lt;!--#include file="inc/submenu.asp"--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;td width="18" height="35" background="body_images/white/bar_right_gray.jpg"&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;table width="80%" align="center" cellpadding="0" cellspacing="0" &gt;
&lt;tr&gt;
&lt;td width="18" rowspan="2" background="body_images/white/bar_left.jpg"&gt;&lt;img src="body_images/white/pixel.gif" width="1" height="1" /&gt;&lt;/td&gt;
&lt;td width="150" bgcolor="#CCCCCC"&gt;&lt;/td&gt;
&lt;td colspan="2" rowspan="2" valign="top" bgcolor="#CCCCCC"&gt;&lt;div id="body_shell" style="padding:5px; background-color:white; border:1px dashed #333333; margin-left: 5px; margin-top: 5px;"&gt;
&lt;table width="100%" border="0" cellspacing="1" cellpadding="4"&gt;
&lt;%
While ((Repeat3__numRows &lt;&gt; 0) AND (NOT rsProducts.EOF))
%&gt;
&lt;tr&gt;
&lt;th colspan="2" scope="row"&gt;&lt;div align="left" style="background-color:#CCCCCC; border-bottom:2px solid red; "&gt;&lt;%=(rsProducts.Fields.Item("txtProdCode".Value)%&gt;&lt;br /&gt;
&lt;%=(rsProducts.Fields.Item("textProdName".Value)%&gt; &lt;/div&gt; &lt;div align="left"&gt;&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;/th&gt;
&lt;td width="200" rowspan="2"&gt;&lt;div align="left"&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;img name="" src="&lt;%=(rsProducts.Fields.Item("txtImagename".Value)%&gt;" alt="" /&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th valign="top" scope="row"&gt;&lt;div align="left"&gt;&lt;%=(rsProducts.Fields.Item("memDescription".Value)%&gt;&lt;/div&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th scope="row"&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;/th&gt;
&lt;td width="200"&gt;&lt;div align="left"&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;%
Repeat3__index=Repeat3__index+1
Repeat3__numRows=Repeat3__numRows-1
rsProducts.MoveNext()
Wend
%&gt;

&lt;/table&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;/div&gt;&lt;/td&gt;
&lt;td width="18" rowspan="2" background="body_images/white/bar_right.jpg"&gt;&lt;img src="body_images/white/pixel.gif" width="1" height="1" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="190" valign="top" bgcolor="#CCCCCC"&gt;&lt;div id="menu"&gt;
&lt;!--#include file="inc/nav.asp"--&gt;
&lt;div align="right"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td width="18"&gt;&lt;div align="right"&gt;&lt;img src="body_images/white/corner_left_bottom.jpg" width="18" height="18" /&gt;&lt;/div&gt;&lt;/td&gt;
&lt;td colspan="3" background="body_images/white/bar_bottom.jpg" bgcolor="#CCCCCC"&gt;&lt;img src="body_images/white/pixel.gif" width="1" height="1" /&gt;&lt;/td&gt;
&lt;td width="18"&gt;&lt;img src="body_images/white/corner_right_bottom.jpg" width="18" height="18" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/html&gt;
&lt;%
rsProducts.Close()
Set rsProducts = Nothing
%&gt;
[CODE]

Reply to this topic