我使用的是MVC 3和Razor
在我正在使用的那一刻
@model MyProject.viewmodels.Myviewmodel @foreach (var item in Model.MyProperty) { <tr> <td> @Html.ActionLink("Edit","Edit",new { id = item.AdvSlotId }) | @Html.ActionLink("Details","Details",new { id = item.AdvSlotId }) | @Html.ActionLink("Delete","Delete",new { id = item.AdvSlotId }) </td> <td> @item.AdvSlotId </td> <td> @item.Name </td> <td> @item.Description </td> <td> @Html.CheckBox(item.IsPublished,new { @disabled = "disabled" }) </td> <td> @item.Notes </td> </tr> }
视图模型:
namespace MyProject.viewmodels { public class Myviewmodel { public Myviewmodel(List<AdvSlot> advSlots) { MyProperty= advSlots; } public List<AdvSlot> MyProperty { get; set; } } }
在我的模型中显示属性的复选框。因为我做错了,所以我只能显示一个如TRUE的文本。
你能告诉我如何用Razor创建CheckBox?我也需要把它作为READONLY。
谢谢你的帮助。
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。