you can do it like below
--------
int numrows = 3;//optional
int numcells = 2;//optional
for (int j=0; j<numrows; j++) {
TableRow r = new TableRow();
for (int i=0; i<numcells; i++) {
TableCell c = new TableCell();
//ds is your DataSet object should be filled before
c.Controls.Add(new LiteralControl(ds.Tables[0].Rows[j][i].ToString()));
r.Cells.Add(c);
}
Table1.Rows.Add(r);
---------
I supposed the number of rows and columns in DataTable and Table object are the same.if not do it yourself(I think it could be very easy)
HTH.
--------------------------------------------
Mehdi.
|