MVC DataAnnotations如何在3.5领域没有可编辑 [英] mvc DataAnnotations how to make field no editable in 3.5

查看:89
本文介绍了MVC DataAnnotations如何在3.5领域没有可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的实体少数领域,我希望是不可编辑的。展望好像该文档EditableAttribute会做的伎俩。然而,这仅仅是4.0

I have a few field in my entity that i wish to be non-editable. Looking in the docs it seems like "EditableAttribute" would do the trick. However this is only 4.0

只是想知道,如果有,将有欲望影响其他属性。所以要明确,

Just wondering if there are other attributes that would have the desire effect. So be clear,

我有一个名为DateRegistered我希望用显示此作为字符串文本不是场场Html.EditorFor

i have a field called "DateRegistered" i wish to display this as string not text field using "Html.EditorFor"

推荐答案

在[只读]属性应在3.5工作。

The [ReadOnly] attribute should work in 3.5.

这篇关于MVC DataAnnotations如何在3.5领域没有可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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