这里是我当前视图代码:MVCContrib,Html.Grid:如何将基于行的id附加到td标签?
<% Html.Grid((List<ColumnDefinition>)ViewData["Parameters"])
.Columns(column =>
{
column.For(c => c.ID);
column.For(c => c.Name);
}).Render();
%>
我想一个HTML “id” 属性附加到每个 “名” td标签这样:
<table class="grid">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr class="gridrow">
<td>1</td>
<td id="parameter_1">Address</td>
</tr>
<tr class="gridrow_alternate">
<td>2</td>
<td id="parameter_2">Phone Number</td>
</tr>
</tbody>
</table>
我的问题:
我该怎么做?
我认为'属性'扩展方法,但我不知道如何才能使它工作。
吉姆,我实际上得到它的工作,检查我编辑的答案。 – 2009-11-18 17:49:57
@Josh Pearce:我仍然无法编译你的答案。如果第三方有意见,这将是很好的。 – 2009-11-19 21:40:36