对于MVC3一个string
财产,我在~/Shared/EditorTemplates/String.cshtml
创建的局部视图,我已经放置在它下面:如何使用EditorTemplate覆盖标签?
@model System.String
<div class="Input">
@Html.TextBox("", this.Model)
@Html.ValidationMessage("")
</div>
查看结果,它看起来很不错。但标签仍然显示出来。正如你可以看到它不包含在上面的局部视图中,所以它必须来自基本视图。
如何覆盖标签输出,因此当我做@Html.EditorForModel()
时,我的string
属性会有自定义标签?
我最终创建了一个自定义的'Object.cshtml'模板。但我仍然想知道是否有办法重写标签部分。 – 2011-06-13 01:50:24