根据MVC4中的用户角色将字段设置为[required] [英] Set a field to [required] based on User Role in MVC4
本文介绍了根据MVC4中的用户角色将字段设置为[required]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我遇到了这个棘手的问题。
我有一个控件,其可见性将根据用户角色设置。在这种情况下,我无法根据需要设置此属性。
Hi
I am stuck with this tricky problem.
I've a control whose visibility will be set based on user role. In this case i can't set this property as required.
[Required(ErrorMessage = Client Name is required)]
[Display(Name ="Client Name")]
public string SelectedClientName { get; set; }
如果有办法将字段设置为 requried * 你可以建议我吗u>基于用户角色?
问候
Vishnu tej
Could you please suggest me if there is a way out to set the field to requried* based on user role?
Regards
Vishnu tej
推荐答案
你可以看看这个 [ ^ ]帮助。
如果没有,如果你谷歌 mvc动态必需字段 [ ^ ]。
You can see if this[^] helps.
If not, there's a bunch more options if you Google for "mvc dynamic required field[^]".
您好,请访问此链接
http:// stackoverflow .com / questions / 14321815 / mvc4-data-annotation-validation-based-on-different-user-roles-using-entity-frame [ ^ ]
hi please visit this link
http://stackoverflow.com/questions/14321815/mvc4-data-annotation-validation-based-on-different-user-roles-using-entity-frame[^]
这篇关于根据MVC4中的用户角色将字段设置为[required]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文