0
我正在使用asp.net mvc3.0 razor框架和html表来绑定与ViewBag的帮助数据。我必须在下拉列表中根据选定的选项显示数据。Mvc网格数据绑定
public ActionResult Index(GetFileName fn)
{
....
ViewBag.Grid1Data =dt;
return View();
}
,第一时间,我得到的数据,但是当从下拉另一个选项被选中获得第二餐桌旁时,不显示表,但我为获取数据。
查看包括 下拉
<select id="Select2">
<option>Select</option>
<option>abc</option>
<option>des</option>
<option>fgh</option>
<option>next</option>
<option>first</option>
</select>
// Heading for the table
<h2>@ViewBag.Heads</h2>
// Table
<table id="table" cellpadding="10px" cellspacing="0" class="TableSty">
@for (int j = 0; j < ViewBag.Grid1Data.Rows.Count; j++)
{
var color = "";
if (j % 2 == 0)
{ color = "#f2f2f2"; }
else { color = "white"; }
<tr style="background:@color" >
@for (int c = 0; c < @ViewBag.Grid1Data.Columns.Count; c++)
{
<td class="data">@ViewBag.Grid1Data.Rows[j][c].ToString()
</td>
}
</tr>
}
</table>
请帮我解决这个问题
我们可以看到您的视图,包括任何脚本吗? – 2011-03-21 14:34:48