MVC中Html.EditorFor宽度及高度怎么设定

MVC中Html.EditorFor宽度及高度怎么设定,第1张

C# code<%= Html.EditorFor(model =>model.Content, new { width="200px",height="150px"})%>

添加自定义样式@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 = "" })

就可以了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/6284781.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-19
下一篇 2023-03-19

发表评论

登录后才能评论

评论列表(0条)

保存