Sunday, 25 August 2013

Generate HTML table from DataGrid

Generate HTML table from DataGrid

This may be plain easy, but somehow I can't think of a direct way. Is it
posible to generate the HTML output (the <TABLE>) from a DataGrid object
on the server-side? Something like:
MyDataGrid.DataSource = MyDataTable;
MyDataGrid.DataBind();
string My_HTML_Table = MyDataGrid.A_Fancy_Method_To_Generate_HTML();
At this point the string My_HTML_Table should have something like
<TABLE><TR><TD>1</TD>...</TABLE>.

No comments:

Post a Comment