How to create dynamic table with the complex structure and different styles of cells?
I have a lot of code such as:
In Controller:
string styleTag = "class=\"someCssStyle\"";
ViewBag.htmlRawName1 += "<td colspan=\"" + colspan +
"\" " + styleTag + ">" + name + "</td>";
for (int i = 0; i < list.count; i++)
{
ViewBag.htmlRawName2 += "<td " + styleTag + ">" + list[i].Name +
"</td>";
}
In View:
<table>
<tr>
@Html.Raw(ViewBag.htmlRawName1 )
</tr>
<tr>
@Html.Raw(ViewBag.htmlRawName2 )
</tr>
</table>
Can I use HtmlHelper instead of this?