grouping data in an asp table control - novice question

J

Joey

Hi There,

I am using an asp table control to display some data, the fields I have are
size,colour,qoh. I have the table structure that I would like to have below
and I have been playing around with datasets and looping to write rows / etc
I'm just having trouble displaying the data the way I want to.

I did have a look at nested datalists, however I don't have the luxury of
time at the moment and I would like to use this method as I'm new to asp
..net as well.

If someone could help me out with the code that would be fantastic, thanks
in advance

Joey

!-- I need to display the data like this

<table width="75%" border="1">
<tr>
<td width="15%">size / colour</td>
<td width="45%">xxs</td>
<td width="13%">xs</td>
<td width="9%">s </td>
<td width="10%">m</td>
<td width="8%">l</td>
</tr>
<tr>
<td>blue</td>
<td>2</td>
<td>10</td>
<td>2</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>green</td>
<td>3</td>
<td>5</td>
<td>4</td>
<td>5</td>
<td>7</td>
</tr>
</table>


Dim dataArray(,) As String

Dim i, j As Integer

Dim myconnection As New OleDb.OleDbConnection()

myconnection = common.connDB()



Dim DS As DataSet = New DataSet()





Dim strColourSql As String = SELECT qoh, shopsales.size,shopsales.shop,
shopsales.style, shopsales.colour,co.colourdesc,sz.sizedesc FROM
shopsales,shops JOIN colours co ON shopsales.colour = co.colour where
shopsales.shop=1 and shopsales.style="'10475RIB1'"

myconnection.Open()

Dim myColourDataAdapter As New OleDb.OleDbDataAdapter(strColourSql,
myconnection)

myColourDataAdapter.Fill(DS, "shopsales")

Dim rowCount As Integer = DS.Tables(0).Rows.Count

Dim colCount As Integer = DS.Tables(0).Columns.Count

ReDim dataArray(rowCount, colCount)

For i = 0 To rowCount - 1

For j = 0 To colCount - 1

If DS.Tables(0).Rows(i).Item(j) Is DBNull.Value Then

dataArray(i, j) = ""

Else

dataArray(i, j) = DS.Tables(0).Rows(i).Item(j)

End If

Next

Next



Dim r As TableRow

Dim c As TableCell

For j = 0 To colCount - 1

r = New TableRow()

c = New TableCell()

c.Controls.Add(New _

LiteralControl(DS.Tables(0).Columns(j).ColumnName))

c.VerticalAlign = VerticalAlign.Top

c.Style("background-color") = "lightblue"

r.Cells.Add(c)

For i = 0 To rowCount - 1

c = New TableCell()

c.Controls.Add(New LiteralControl(dataArray(i, j)))

c.VerticalAlign = VerticalAlign.Top

r.Cells.Add(c)

Next i

Table1.Rows.Add(r)

Next j
 
C

Cor Ligthert

Hi Joey,

When you do not have the luxury of time, why do you than not hire somebody
or a compony to do it for you instead to ask if somebody will do it in this
newsgroup for you?.

Just my thought?

Cor
 
J

Joey

I thought that news groups where about people helping people, if I have a
code snippet to help me out then maybe I can learn and then in turn share
the knowledge with someone else, obviously I am in the wrong place.

and who should hire you?

Sean
 
C

Cor Ligthert

"Joey"
I thought that news groups where about people helping people, if I have a
code snippet to help me out then maybe I can learn and then in turn share
the knowledge with someone else, obviously I am in the wrong place.
That is not in your question, you did not ask for a snippet you have
supported some code and asked to make a program from that and told you had
not the luxury of time to do it yourself.

When you want a snippet you tell your problem and ask if somebody will bring
you in the right direction and then you will get a lot of answers, because
in this newsgroups everybody wants to help including me.

However when you do not have time to investigate that snippet, you better
can hire somebody,
because it will need time.
and who should hire you?

Did I tell that, there are probably enough in your neighbourhoud who will
help you when you have not the luxury of time yourself and are willing to
pay for that.

And when you have time yourself, you can look at the datagrid, I took some
time to look at your problem, and probably that will easily help you

http://msdn.microsoft.com/library/d...fsystemwebuiwebcontrolsdatagridclasstopic.asp

Cor
 
J

Joey

looking at my question now I realise maybe I should have "worded" it a
little different, sorry to offend.

Sean Joey Jones
 

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

Top