0
A
回答
2
下面是一个例子:
在你的 “示范课”:
public class TennisCourt
{
[Key]
public int ID { get; set; }
[Display(Name = "Extérieur ?")]//=Outside in french
[Column("Outside")]
public bool Outside { get; set; }
}
在你的 “视图索引”
@model IEnumerable<TennisOnline.Models.TennisCourt>
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Gestion des Courts</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>
Id
</th>
<th>
Outside ?
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.ID)
</td>
<td>
@Html.DisplayFor(modelItem => item.Outside)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
下面是结果:
相关问题
- 1. 如何在slickgrid中添加复选框?
- 2. 如何在listview中添加复选框?
- 3. 如何在复选框添加文本时添加复选框(Livecycle Designer)
- 4. 如何在Ultrawebgrid上添加复选框?
- 5. 如何获取在MVC3中选中的一个复选框?
- 6. 如何在pref中添加选中的复选框
- 7. 添加复选框在UltraGrid
- 8. 如何在列表框中添加条件复选框zk
- 9. 如何在使用png的复选框中添加边框
- 10. 如何在c#中的组合框内添加复选框
- 11. 如何将复选框添加到UITableViewCell?
- 12. 如何添加复选框到Ext.tree.TreePanel?
- 13. 如何添加复选框列到gridview
- 14. 如何添加复选框hybirs
- 15. MVC3选中的复选框的数量
- 16. 在Treeview中添加复选框
- 17. blackberry:在列表中添加复选框
- 18. 在java中动态添加复选框
- 19. 在flexigrid中添加复选框列
- 20. 在javascript中添加innerHTML复选框
- 21. 在JTable中添加复选框
- 22. 动态生成Telerik MVC3网格 - 添加复选框
- 23. 如何只添加选中的复选框添加到数组列表中?
- 24. MVC3 Ajax复选框grid
- 25. 如何在分页的mvc3 webgrid中保留复选框值
- 26. 如何为jquery mobile中的复选框添加边框
- 27. 添加复选框按钮
- 28. 添加新的复选框
- 29. 添加复选框到ComboboxItem
- 30. 动态添加复选框
你使用实体框架?你想将数据保存在数据库中吗? – Razor 2012-03-15 09:48:28
@Francesco是的,我想将它保存在数据库中,我使用实体框架 – Dip 2012-03-15 10:20:39
那么,你使用“代码优先”与“模型类”? – Razor 2012-03-15 10:25:43