I am creating Dynamic HTML Table Markup filled with the Data from DataTable using C#. I am using the StringBuilder object Built-up HTML markup. On compilation i am getting error "Unable to Convert string to String builder"
Code:
DataTable dt=new DataTable();
dt=GetData();
StringBuilder strDeviceList=new StringBuilder();
strDeviceList = "<table style='width:100%;text-align:center;'>" +
"<tr>" +
"<td> Quote ID</td><td>Device</td><td> Generation</td><td>Condition</td><td>Price</td>" +
"</tr>";
foreach (DataRow row in dt.Rows)
{
strDeviceList.Append("<tr>" +
"<td>" + row["QuoteID"] + "</td><td>" + row["Name"] + "</td><td>" + row["Generation"] + "</td><td>" + row["Condition"] + "</td><td>" + row["Price"] + "</td>" +
"</tr>");
}
strDeviceList.Append("</table>");
Any idea? Help Appreciated!