Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Display Records in Columns

Hello All;

Can someone take a look at this code and let me know what I am doing wrong.
Explaination:

Category <-- DINCTINCT
     Subcategory

Cat1               Cat2
subC1            subC1
subC2            subC2
subC3            subC3

I can do this as a list, and it works great, but doing it in multiple coulmns like 4 columns per row
I cannot get it to work.

demo
http://ee.cffcs.com/Q_24379297/columns.asp
code
http://ee.cffcs.com/Q_24379297/Q_24379297.zip

Thanks all
Carrzkiss

Avatar of kevp75
kevp75
Flag of United States of America image

i'm not so sure I would do this in a table...

may want to consider just using floated divs, just remember to give them a static width.

Avatar of Wayne Barron

ASKER

Hey Kevp.
Long time since we did a post together.

Interested in the <div> idea. Would you perhaps have an idea as how to accomplish it?
SOLUTION
Avatar of kevp75
kevp75
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That is pretty sweet.
But cannot seem to implement it as needed?

See what is needed is for it to show:

Category1         Category2     Category3
subcat-11         subcat-21      sucbat-31
subcat-12         subcat-22      sucbat-32
subcat-13         subcat-23      sucbat-33
Exc....

I am not much of a <DIV> Programmer.
I usually do all my work in Tables, but if a DIV will make it easier to work with
Then I am all for using it. Just need a little instruction as to how to accomplish what is needed.
And right now, I need to accomplish a Structure as shown above.

Any idea's on how to implement the DIV's here?
Thanks once again.

Carrzkiss
You can use what I posted above, just need to tweak the width of .column to match your needs...

can you post your code you are using to try to generate this?
CSS
 
#wrapper {
width:760px;
clear:both;
}
.column {
width:220px; /*Tweak this to suit your needs*/
float:left;
}
 
HTML
 
<div id="wrapper">
<div class="column">
  Category 1
  <br />
  Sub-Category 1 <br />
  Sub Category 2
</div>
<div class="column">
  Column 2
</div>
<div class="column">
  Column 3
</div>
<div class="column">
  Column 4
</div>
<div class="column">
  Column 5
</div>
<div class="column">
  Column 6
</div>
</div>

Open in new window

Try this out:


<%
Dim objConn, objRs, i, strConnString, tmpArr, getS
getS = Request.QueryString("ID")
Set objConn = Server.CreateObject("ADODB.Connection")
	strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("tempdb.mdb") & ";"
	objConn.Open strConnString
		Set objRs=objConn.Execute("SELECT Company.CID, Company.CName, Products.PID, Products.CID, Products.PName, Products.PDesc FROM Company INNER JOIN Products ON Company.CID = Products.CID")
			If Not(objRs.Eof) Then
				tmpArr = objRs.GetRows()
			End If
		Set objRs = Nothing
	objConn.Close
Set objConn = Nothing
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Untitled Document</title>
        <style type="text/css">
			.tdRow{
				border:1px #000000 double;
			}
			#wrapper {
				width:760px;
				clear:both;
			}
			.column {
				width:190px; /*Tweak this to suit your needs*/
				float:left;
			}
        </style>
    </head>
    <body>                
        <div id="wrapper">
			<%
            If IsArray(tmpArr) Then
                For i = 0 To UBound(tmpArr, 2)
                    Response.Write("<div class=""column"">" & tmpArr(1, i) & "</div>" & VbCrLf)
                Next : i = Null
                Erase tmpArr
            End If
            %>
        </div>    
    </body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
WOW
That took more then 4 days... :~)

Have a good one.
Carrzkiss