Repeating horizontally

O

Owen Blacker

Bear with me, this query isn't fun.

I'm building an e-commerce site and the Information Architecture for
the
Product Comparison page requires repeating horizontally:


+----------+--------------+--------------+--------------+--------------+
| | [Image] | [Image] | [Image] | [Image]
|
| | | | |
|
| | Product name | Product name | Product name | Product
name |
| | as hyperlink | as hyperlink | as hyperlink | as
hyperlink |
| | | | |
|
| | Price | Price | Price | Price
|
| | | | |
|
| | Description | Description | Description |
Description |

+----------+--------------+--------------+--------------+--------------+
| Product specifications (colspanned)
|

+----------+--------------+--------------+--------------+--------------+
| Weight | #### kg | #### kg | #### kg | #### kg
|

+----------+--------------+--------------+--------------+--------------+
| Material | Blah blah | Blah blah | Blah blah | Blah blah
|

+----------+--------------+--------------+--------------+--------------+
| Another | Blah blah | Blah blah | Blah blah | Blah blah
|
| detail | blah blah | blah blah | blah blah | blah blah
|

+----------+--------------+--------------+--------------+--------------+

where the number of products being compared is variable. (To
complicate
matters further, I don't necessarily know what the row headers on the
left
are either, as they vary by product type, but that's another issue and
isn't why I'm mailing the list.)

Now the data need to be in a table, obviously, but can't be in more
than
one table, as that would completely destroy the accessibility of the
page.

I can't see how I could use a regular Repeater control, as the
ItemTemplate
can't contain <tr> or </tr> tags (which would cause each product-column
to
scroll *down* the page, rather than *across* it.

I can't see how I could use a DataGrid, as the first row contains much
more
complex data (an image, a hyperlink, some text and so on).

Does anyone have *any* ideas on how I might databind my source to
*something*
so this might work?

All suggestions greatly appreciated. If people could cc: me on any
replies,
so I notice them that little quicker, that would be even better.

Thanks, everyone,


Owen Blacker
--
Owen Blacker
Senior Software Developer

Wheel: insight | thinking | creativity

(e-mail address removed) www.wheel.co.uk
 
J

Jim Underwood

I think what you are trying to do is display the columns as rows and the
rows as columns... if that is the case, the following code should help...

This function will tkae a datatable and turn the rows into columns and the
columns into rows.

Where dattbl1 is your original datatable...

dim dattbl2 as datatable
dattbl2 = ReverseTable(dattbl1)
DataGrid2.DataSource = dattbl2

Private Function ReverseTable(ByVal dattbl1 As DataTable) As DataTable
Dim i, x As Integer
Dim strDummy As String = ""
Dim datTableOut As New DataTable
Dim dr As DataRow
datTableOut.Columns.Add("ColumnName", strDummy.GetType)
For i = 0 To dattbl1.Rows.Count - 1
datTableOut.Columns.Add("Column" & i, strDummy.GetType)
Next
For i = 0 To dattbl1.Columns.Count - 1
dr = datTableOut.NewRow()
dr("ColumnName") = dattbl1.Columns(i).ColumnName
For x = 0 To dattbl1.Rows.Count - 1
dr("Column" & x) = dattbl1.Rows(x).Item(i)
Next
datTableOut.Rows.Add(dr)
Next
Return datTableOut
End Function
Owen Blacker said:
Bear with me, this query isn't fun.

I'm building an e-commerce site and the Information Architecture for
the
Product Comparison page requires repeating horizontally:


+----------+--------------+--------------+--------------+--------------+
| | [Image] | [Image] | [Image] | [Image]
|
| | | | |
|
| | Product name | Product name | Product name | Product
name |
| | as hyperlink | as hyperlink | as hyperlink | as
hyperlink |
| | | | |
|
| | Price | Price | Price | Price
|
| | | | |
|
| | Description | Description | Description |
Description |

+----------+--------------+--------------+--------------+--------------+
| Product specifications (colspanned)
|

+----------+--------------+--------------+--------------+--------------+
| Weight | #### kg | #### kg | #### kg | #### kg
|

+----------+--------------+--------------+--------------+--------------+
| Material | Blah blah | Blah blah | Blah blah | Blah blah
|

+----------+--------------+--------------+--------------+--------------+
| Another | Blah blah | Blah blah | Blah blah | Blah blah
|
| detail | blah blah | blah blah | blah blah | blah blah
|

+----------+--------------+--------------+--------------+--------------+

where the number of products being compared is variable. (To
complicate
matters further, I don't necessarily know what the row headers on the
left
are either, as they vary by product type, but that's another issue and
isn't why I'm mailing the list.)

Now the data need to be in a table, obviously, but can't be in more
than
one table, as that would completely destroy the accessibility of the
page.

I can't see how I could use a regular Repeater control, as the
ItemTemplate
can't contain <tr> or </tr> tags (which would cause each product-column
to
scroll *down* the page, rather than *across* it.

I can't see how I could use a DataGrid, as the first row contains much
more
complex data (an image, a hyperlink, some text and so on).

Does anyone have *any* ideas on how I might databind my source to
*something*
so this might work?

All suggestions greatly appreciated. If people could cc: me on any
replies,
so I notice them that little quicker, that would be even better.

Thanks, everyone,


Owen Blacker
--
Owen Blacker
Senior Software Developer

Wheel: insight | thinking | creativity

(e-mail address removed) www.wheel.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top