jschoice2002 Posted June 11, 2010 Share Posted June 11, 2010 Hi,Can someone please help me, im trying to make a dynamic table. I manage te make a table that fills from top to bottom. But i need a table with 3 columns that fills from left to right. I only get this far where the rows( understandably) keep multiplying which is not what i want.Dim RsQmenu Set RsQmenu = Server.CreateObject("ADODB.Recordset") RsQmenu.ActiveConnection = MM_connCMS_STRING RsQmenu.Source = "SELECT * FROM subs WHERE QuickMenu = 'Y' order by subItemno" RsQmenu.Open() QuickHead= (RsQmenu.Fields.Item("subItemHead").Value)%></head><body><%Response.Write("<table width=100% border=0 cellspacing=10 class=bottomlinks>")Do until RsQmenu.EOFResponse.Write("<tr>")Response.Write("<td align=left valign=top>"&QuickHead&"</td>")Response.Write("<td align=left valign=top>"&QuickHead&"</td>")Response.Write("<td align=left valign=top>"&QuickHead&" </td>")Response.Write("</tr>")RsQmenu.Movenext()LoopResponse.Write("</table>")%>Thanks in advance..Jaco Link to comment Share on other sites More sharing options...
dsonesuk Posted June 11, 2010 Share Posted June 11, 2010 for showing three columns of data, you have to count the cells, then for 1st column you start with tr start tag <tr> and on the last column you insert the closing row tag </tr>, then reset count to 1.problem is you have to allow for eof finishing before entering the third column, to fix this, use a loop to insert empty cells<td> </td> using the current count value, and finish with </tr> tag.sorry the code is not vb, but it gives you the idea.<%Response.Write("<table width=100% border=0 cellspacing=10 class=bottomlinks>")count = 0;Do until RsQmenu.EOFcount++;if(count=1){Response.Write("<tr>")}Response.Write("<td align=left valign=top>"&QuickHead&"</td>")if(count = 3){Response.Write("</tr>")count=0;}RsQmenu.Movenext()Loopif(count<3 && count !=0){for(i=count;i<=count;i++){Response.Write("<td> </td>")}Response.Write("</tr>")}Response.Write("</table>")%> Link to comment Share on other sites More sharing options...
jschoice2002 Posted June 14, 2010 Author Share Posted June 14, 2010 thankkkss dsonesuk, That did the trick...you've really helped me out...i was stuck on this thing for daysthis is what i got in the end... <% i = 1Response.Write("<table width='100%' border='0' cellpadding='0' cellspacing='0' class='bottomlinks'>" & Vbcrlf ) Do until RsQmenu.EOF Select Case i case 1Response.Write("<tr>" & Vbcrlf )Response.Write("<td width=150 align=left valign=top class=bottomlinks><ul class=bottomlinks>"& Vbcrlf&("<li><a href='index.asp?page=2⊂="&(RsQmenu.Fields.Item("subItemno").Value)&"'>"&(RsQmenu.Fields.Item("subItemhead").Value)&"<BR></a></li></ul>")&"</td>" & Vbcrlf ) case 2Response.Write("<td width=150 align=left valign=top class=bottomlinks> <ul class=bottomlinks>"& Vbcrlf&("<li><a href='index.asp?page=2⊂="&(RsQmenu.Fields.Item("subItemno").Value)&"'>"&(RsQmenu.Fields.Item("subItemhead").Value)&"<BR></a></li> </ul>")&"</td>" & Vbcrlf ) case 3Response.Write("<td width=171 align=left valign=top class=bottomlinks> <ul class=bottomlinks>"& Vbcrlf&("<li><a href='index.asp?page=2⊂="&(RsQmenu.Fields.Item("subItemno").Value)&"'>"&(RsQmenu.Fields.Item("subItemhead").Value)&"<BR></a></li> </ul>")&"</td>"&"</tr>" & Vbcrlf ) i = 0 End Select i = i + 1RsQmenu.Movenext() LoopResponse.Write("</table>" & Vbcrlf )%> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.