EditorFor() 和 html 属性 [英] EditorFor() and html properties

查看:32
本文介绍了EditorFor() 和 html 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Asp.Net MVC 2.0 预览版提供了像

Asp.Net MVC 2.0 preview builds provide helpers like

Html.EditorFor(c => c.propertyname)

如果属性名是字符串,上面的代码会渲染一个文本框.

If the property name is string, the above code renders a texbox.

如果我想将 MaxLength 和 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

为模板添加 html 属性支持 - ASP.Net MVC 2.0 Beta

这篇关于EditorFor() 和 html 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆