Write an Article Write a Tutorial Add a Fast Code* *Fast Code might be any helpful code with brief comment
Stem Cells Blood Banks Insurances .Net Hosting Credit Cards PC Rental Business
Tutorials: ASP .NET C# .NET VB .NET Articles: ASP .NET C# .NET VB .NET Fast Code: ASP .NET C# .NET VB .NET
We will make an account on creating an HTML Table from a DataTable. This can be very usefull in some cases when a small Data is need be displayed. public static string ConvertToHtmlFile(DataTable sentDataTable) { // Check if the Sent DataTable is not empty or a Null if (sentDataTable == null) { throw new System.ArgumentNullException("sentDataTable"); }
//Get a worker object. StringBuilder myStringBuilder = new StringBuilder();
//Open tags and write the top portion. myStringBuilder.Append(""); myStringBuilder.Append("
//Add the headings row.
myStringBuilder.Append("
foreach (DataColumn myColumn in sentDataTable.Columns) { myStringBuilder.Append("
//Add the data rows. foreach (DataRow myRow in sentDataTable.Rows) { myStringBuilder.Append("
//Close tags. myStringBuilder.Append("
return myStringBuilder.ToString(); }
why not use datagrid or gridview?
03/04/2007 15:00:56 UTC
This was just an Idea. Of Course Gridview/Datagrid are dynamic implementaions of the Data Presentation and also there is no better replacement for that.
This also tells the way Gridview displays Data in the HTML Format.
03/04/2007 15:59:20 UTC
01/03/2008 06:02:19 UTC
29/07/2008 22:25:01 UTC