【发布时间】:2011-11-03 12:10:29
【问题描述】:
我需要根据@Html.CheckBox 中使用的模型(布尔)属性值更改表中给定行的背景颜色。使用 PostExampleCompleted 操作方法中的新复选框值更新模型。
<table>
<thead>
<tr>
<th>Item name</th>
<th>Comments</th>
<th>User</th>
<th>Complete</th>
</tr>
</thead>
<tbody>
<tr id="FooRow">
<td>Foo</td>
<td>@Model.FooComments</td>
<td>@Model.FooUserName</td>
<td>
@using (Ajax.BeginForm("PostFooCompleted", "Home", new AjaxOptions { OnBegin = "ShowProcessingMsg", OnComplete = "HideProcessingMsg" }))
{
@Html.CheckBox("FooItemComplete", Model.FooComplete, new { onClick = "$(this).parent('form:first').submit();" })
}
</td>
</tr>
<tr id="WidgetRow">
<td>Widget</td>
<td>@Model.WidgetComments</td>
<td>@Model.WidgetUserName</td>
@using (Ajax.BeginForm("PostWidgetCompleted", "Home", new AjaxOptions { OnBegin = "ShowProcessingMsg", OnComplete = "HideProcessingMsg" }))
{
@Html.CheckBox("WidgetItemComplete", Model.WidgetComplete, new { onClick = "$(this).parent('form:first').submit();" })
}
</td>
</tr>
</tbody>
</table>
实现这一目标的最佳方法是什么?代码示例将不胜感激:)。
谢谢。
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-3 asp.net-mvc-2 jquery