[AccessD] OT - ASP, Build a web table on the fly

Doris Manning mikedorism at verizon.net
Thu Oct 9 15:37:33 CDT 2008


Here is some C# code that we use in a website to dynamically create a table
with 4 columns on the fly...

dynTable = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\">";
foreach (DataRow Row in dtData.Rows)
   {
   //start table row 
   dynTable += "<tr>";
   //inner loop to generate columns 
   for (int tCols = 0; tCols < 4; tCols++)
      {
	      // create td column tag 
 	     	dynTable += "<td>";
		// add column data
	     	dynTable += Row[tCols].ToString();
	     // close td column tag 
   	   	dynTable += "</td>";
      }
      // close table row 
      dynTable += "</tr>";
    }
// close the table tag 
dynTable += "</table>";
Literal1.Text = dynTable;

Doris Manning
Database Administrator
Hargrove Inc.





More information about the AccessD mailing list