ビューに次のテーブルがあります。
<table id="tblHelpRow">
<thead>
<tr class="title">
<th>
1
</th>
<th>
2
</th>
<th>
3
</th>
<th>
4
</th>
</tr>
</thead>
<tbody id="helpRowBody">
@{ ViewData["MattersTable"].ToString(); }
</tbody>
</table>
コントローラーで、このテーブルの本体を作成し、DataView に追加します。別のコントローラーからリダイレクトして DataTable を渡すことで、このコントローラーにアクセスしています。実際には少し違いますが、ここでは問題を示すためにできるだけ簡単に書きました。
public ActionResult Matters(DataTable source)
{
string result = "";
foreach(DataRow dr in source.Rows)
{
result += "<tr>" +
"<td>" + dr["1"] + "</td>" +
"<td>" + dr["2"] + "</td>" +
"<td>" + dr["3"] + "</td>" +
"<td>" + dr["4"] + "</td>" +
"</tr>";
}
ViewData["MattersTable"] = result;
return View();
}
しかし、結果として、列ヘッダーを含むページを取得しましたが、内部にはコンテンツがありません... ソースページは、tbody の内部には何もないことを示しています...