我想在MVC剃刀页面上设置一个文本区域,如下所示:
@Html.TextAreaFor(e => e.Description)
Run Code Online (Sandbox Code Playgroud)
但我不知道在页面上为此方法设置重载的htmlattributes是一种整洁的方法.或许我可以在模特身上做到这一点?
知道怎么做这两种方式真的很好:-)
就像是,
@Html.TextAreaFor(e => e.Description, new { yourattribute = "Hello" })
Run Code Online (Sandbox Code Playgroud)
这是一种匿名类型.如果您需要使用语言关键字,例如class,使用@转义它:
@Html.TextAreaFor(e => e.Description, new { @class = "yourCSSclass", yourattribute = "Hello" })
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6141 次 |
| 最近记录: |