You could create a ViewHelper:
@helper RenderTable(Dictionary<string, System.Data.DataView> model)
{
<table>
@foreach (var group in Model)
{
<tr>
<th colspan="3">@group.Key</th>
</tr>
foreach (System.Data.DataRowView data in group.Value)
{
<tr>
<td>@data.Row["col1"]</td>
<td>@data.Row["col2"]</td>
<td>@data.Row["col3"]</td>
</tr>
}
}
</table>
}
Then call it:
@{
string output = RenderTable(someData).ToHtmlString();
}