EditorFor()和HTML属性 [英] EditorFor() and html properties
问题描述
Asp.Net MVC 2.0 preVIEW建立提供佣工像
Asp.Net MVC 2.0 preview builds provide helpers like
Html.EditorFor(c => c.propertyname)
如果属性名称是字符串,上面的code呈现一个texbox。
If the property name is string, the above code renders a texbox.
如果我想在最大长度和Size属性的文本框或我自己的CSS类属性?通过
What if I want to pass in MaxLength and Size properties to the text box or my own css class property?
我需要为我的应用程序的每个大小和长度组合的一个模板?如果是这样,这并不使该使用的默认模板。
Do I need to create one template for each size and length combinations in my application? If so, that doesn't make the default templates that usable.
推荐答案
我写了一篇博客条目回答我的问题。
I wrote a blog entry to answer my own question
<一个href=\"http://aspadvice.com/blogs/kiran/archive/2009/11/29/Adding-html-attributes-support-for-Templates-_2D00_-ASP.Net-MVC-2.0-Beta_2D00_1.aspx\"相对=nofollow>添加HTML属性模板支持 - ASP.Net MVC 2.0 Beta版
这篇关于EditorFor()和HTML属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!