启用/禁用MVC Razor视图引擎上的控件 [英] Enable/Disable controls on a MVC Razor view engine
本文介绍了启用/禁用MVC Razor视图引擎上的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用MVC Razor视图引擎启用/禁用网页上的控件
how to Enable/Disable controls on a web page using MVC Razor view engine
推荐答案
您可以在MVC控件中使用disabled属性,如下所示:
@ Html.TextBoxFor(m => m.ModelPropertyName,new {disabled =disabled})
如果你想让它只读,那就用下面的代码
@ Html.TextBoxFor(m => m.ModelPropertyName, new {@readonly =readonly})
you can use the disabled property in the MVC Control like below:
@Html.TextBoxFor(m => m.ModelPropertyName,new{disabled="disabled"})
If you want to make it readonly then use below code
@Html.TextBoxFor(m => m.ModelPropertyName, new { @readonly = "readonly" })
您好,
请参阅下面的CodeProject文章。
使用MVC Razor视图引擎和扩展方法启用/禁用网页上的控件 [ ^ ]
谢谢
Hi,
Please refer CodeProject article below.
Enable/Disable controls on a web page using MVC Razor view engine and Extension methods [^]
Thanks
CodeProject [ ^ ]
google上的第一个答案。下次再不是盲目地问。谢谢。
CodeProject[^]
First answer on google. Next time to that instead of asking blindly. Thank you.
这篇关于启用/禁用MVC Razor视图引擎上的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文