-
3 item per row
I use the code below to add a table with each datarow
Code:
TableRow rowItem = new TableRow();
TableCell cellColumnInfo = new TableCell();
cellColumnInfo.VerticalAlign = VerticalAlign.Top;
cellColumnInfo.Width = 600;
Label lblProdName = new Label();
lblProdName.Text = dr["ProductName"].ToString();
cellColumnInfo.Controls.Add(lblProdName);
rowItem.Cells.Add(cellColumnInfo);
Label lblProdDesc = new Label();
lblProdDesc.Text = "<br>" + dr["ProductDescription"].ToString();
cellColumnInfo.Controls.Add(lblProdDesc);
//add the cells to the new row
Table1.Rows.Add(rowItem);
it works, but it only add only 1 item per row. all i want to happen is it will display the first 3 on the first row and the 2nd 3 on the second row.. and so on..
how can I do that with asp.net?
-
Re: 3 item per row
Instead of using same cell i.e. cellColumnInfo may be you can add each column's value in New TableCell vairbale
-
Re: 3 item per row
Hello,
Rather than using a Table control, why not use a DataList:
http://msdn.microsoft.com/en-us/libr...direction.aspx
From what you have said, this is set up to do exactly what you want.
Gary
-
Re: 3 item per row
i want to display the items dynamically. hope you can help me with this..
-
Re: 3 item per row
Can you define "dynamically". The repeater will "grow" based on the number of records that you give it.
Gary