我正在尝试用默认值填充editorfor字段。请帮帮忙
我的代码:
<div class="editor-label">
@Html.LabelFor(model => model.Country)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Country)
</div>该模型是由实体框架通过by数据库创建的。
发布于 2012-04-19 21:56:40
为什么不直接使用模型的构造函数呢?
public class CustomerViewModel
{
public string Country { get; set; }
public CustomerViewModel()
{
this.Country = "Default value";
}
}https://stackoverflow.com/questions/10229368
复制相似问题