添加自定义样式@Html.Label(Model.StoreMoney.ToString(),new {@class="balanceValue"})添加属性@Html.Label(Model.StoreMoney.ToString(),new {@style="width:30px"})
html.partial是使用指定的Model执行指定的视图。html.labelfor、textboxfor等,是按照label或textbox的方式输出模式
html.editorfor是使用指定的Model输出视图
此外,还有一个html.displayfor跟html.editorfor类似。
editorfor在输出数据的时候,如果不能满足其特殊需求,会使用TextboxFor来达成目的。
那么editorfor的特殊需求是什么呢?
1、editorfor会默认从shared\editortemplates文件夹里找Model类型名对应的视图文件。
2、可以对editorfor指定模板视图的文件名,如你的代码中的BasicCoreInfomationViewModel
至于DISPLAYFOR,默认的视图文件夹为displaytemplates
@Html.EditorFor(model =>model.Name, new { disabled = "disabled " })@Html.EditorFor(model =>model.Name, new { disabled = "" })
就可以了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)