Ciao ragazzi, come sempre mi rivolgo a voi, in cerca di un aiuto.

Sempre il menù con Sategorie - sotto categorie e sotto sotto categorie.

in pratica è stato effettuato un ciclo, dove si apre una tabella con le sotto categorie, tra una Scategoria e l'altra.
Io vorrei che la tabella si aprisse alla fine di tutte le SCategorie, potreste cercare di aiutarmi a spostare/modificare il codice??

Grazie
Questo il risultato di come viene adesso:
ekkoqui

ed il codice in questione

codice:
			
<table width="100%" border="0" cellspacing="0" cellpadding="3" bordercolordark="#E5E5E5" bordercolorlight="#000000" border="1" style="border-width: 0px">
      <%

	SQLCat = " SELECT ID, SCategoria FROM SCategorie ORDER by SCategoria asc "
	Set RScat = Conn.Execute(SQLCat)	
	
	'if rscat.eof then
	%>
      <%'=NoCategoria%>
      <%'end if
	if Not RSCat.EOF then
		SCatArr = RScat.GetRows

												If QSSCategoria <> "" Then
													SQLCat = " SELECT ID, Categoria FROM Categorie WHERE SCategoria = " & QSSCategoria &" ORDER BY Categoria ASC"
													Set RSCat = Conn.Execute(SQLCat)
													If Not RSCat.EOF Then 
														CatArr = RSCat.GetRows
														BoolCategorie = True
													Else
														BoolCategorie = False
													End If
													RSCat.Close
												End If
												
				For Icat = 0 to UBound(SCatArr, 2)

													sqlcont = " SELECT COUNT(*) AS TotaleRecord FROM Prodotti WHERE cancellato = false and sCategoria = "&sCatArr(0,ICat)
													Set rscont = Conn.Execute(sqlcont)
													Rectot = (rscont("TotaleRecord"))
													rscont.Close
													Set rscont= Nothing
																		%>
      <%if CStr(SCatArr(0,ICat)) = QSSCategoria  then%>
      <%else%>
      <%end if%>
      <%
						If CStr(SCatArr(0,ICat)) = QSSCategoria Then
							If boolCategorie Then
	cont=0
								For K = 0 To UBound(CatArr,2)
	cont=cont+1
	
	if cont=1 then
	%>
      <tr>
	<%
	end if
								
%>
											<% 
											sqlcontsc = " SELECT COUNT(*) AS TotaleRecord FROM Prodotti WHERE cancellato = false and Categoria = "&CatArr(0,k)
											Set rscontsc= Conn.Execute(sqlcontsc)
											Rectotsc = (rscontsc("TotaleRecord"))
											rscontsc.Close
											Set rscontsc = Nothing
											%>
									<%if CStr(CatArr(0,k)) = QSCategoria then%>

												<%if SCategoria <> "" then
												cont=4
												%>
												<td colspan="3">▪<%=CatArr(1,k)%> (<%Response.Write rectotsc%>) </td></tr>
												<%end if%>
												<%if SCategoria = "" then
												cont=4
												%>
												<tr><td colspan="3">
												<DIV style="border:1px dashed #FFFFFF; background-color:#336699; width:100%; height:25px; valign:middle"> 
            <font size="3" color="#FFFFFF" >▼<%=CatArr(1,k)%>(<%Response.Write rectotsc%>)</font></div></td></tr>

												<%end if%>
													<%
													SQLCat = " SELECT * FROM S_Categorie WHERE Categoria = " & CatArr(0,k) &" ORDER BY Categoria ASC"
													Set RSCat = Conn.Execute(SQLCat)
													While Not RSCat.EOF			
													%>
													<%
													sqlcontsc2 = " SELECT COUNT(*) AS TotaleRecord FROM Prodotti WHERE cancellato = false and S_Categoria = "&RSCat("ID")
													Set rscontsc2= Conn.Execute(sqlcontsc2)
													Rectotsc2 = (rscontsc2("TotaleRecord"))
													rscontsc2.Close
													Set rscontsc2 = Nothing
													%>
													
      <tr> 
        <td colspan="3">
          <DIV style="border:1px dashed #999999; background-color:#ECECEC; width:180px; height:25px; valign:middle"> 
            <font color="#336699"><%if StrComp(SCategoria, RSCat("ID")) <> 0 then
																cont=4
																%>
            ◙"><%=RSCat("S_Categoria")%> 
            (<%=Rectotsc2%>) 
            <%end if%>
            <%if StrComp(SCategoria, RSCat("ID")) = 0 then
																cont=4
																%>
            ►<%=RSCat("S_Categoria")%> (<%=Rectotsc2%>) 
            <%end if%>
            </font></div> 
        </td> 
      </tr>
													<%
													RSCat.MoveNext
													Wend
													RSCat.close
													
													%>
										<%end if%>
										<%if CStr(CatArr(0,k)) <> QSCategoria then%>
														<%if SCategoria = "" then%>
														<td>▪<%=CatArr(1,k)%> (<%Response.Write rectotsc%>)</td>
														<%end if%>
														<%if SCategoria <> "" then%>
														<td>▪<%=CatArr(1,k)%> (<%Response.Write rectotsc%>)</td>
														<%end if%>
										<%end if%>
									<%
									if cont=4 then
									%>
									</tr>
									<%
									end if
									if cont=4 then cont=0
									Next
								End If
							End If
					Next
end if
%>
<%if cont<4 then
for a=cont to 4
%>
<td></td>
<%
next
%>

<%end if%>
</table>