hondaman2003
Programmer
I have a website that I would like to display images in rows and columns just like in a table. For example, if I have 9 images, I would like to display them in a 3 columns, 3 rows. This information is going to come from a database so I could have any number of images that need to be displayed but I need to stick to 3 columns and as many rows as needed.
I am trying to dynamically generate this using the asp table control. Here is the code I am using to play with this control and yet, I am only getting a blank page.
HTML
C#
I am trying to dynamically generate this using the asp table control. Here is the code I am using to play with this control and yet, I am only getting a blank page.
HTML
Code:
<asp:Table ID="tblHTMLImageList" runat="server">
</asp:Table>
C#
Code:
protected void Page_Load(object sender, EventArgs e)
{
TableRow tRow = new TableRow();
TableCell tCell = new TableCell();
tCell.Text = "Row 1, Column 1";
tCell.ID = "Cell1";
tRow.Cells.Add(tCell);
tCell.Text = "Row 1, Column 2";
tCell.ID = "Cell2";
tRow.Cells.Add(tCell);
tblHTMLImageList.Rows.Add(tRow);
tRow.Cells.Clear();
tCell.Text = "Row 2, Column 1";
tCell.ID = "Cell3";
tRow.Cells.Add(tCell);
tCell.Text = "Row 2, Column 2";
tCell.ID = "Cell4";
tRow.Cells.Add(tCell);
tblHTMLImageList.Rows.Add(tRow);
}