如何在ASP.NET MVC3剃刀创建只读文本框 [英] How to create readonly textbox in ASP.NET MVC3 Razor
本文介绍了如何在ASP.NET MVC3剃刀创建只读文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建ASP.NET MVC3只读文本框,剃刀视图引擎?是否有一个可用的方法的HtmlHelper做?
像这样的事情?
@ Html.ReadOnlyTextBoxFor(M = GT; m.user code)
解决方案
@ Html.TextBoxFor(M = GT; m.user code,新{@只读=只读})
欢迎您,使HTML帮助这一点,但是这仅仅是就像任何其他的HTML属性。你会做一个HTML帮手具有其他属性的文本框?
How to create a readonly textbox in ASP.NET MVC3, With Razor view engine ? Is there an HTMLHelper method available to do that ?
Something like this ?
@Html.ReadOnlyTextBoxFor(m => m.userCode)
解决方案
@Html.TextBoxFor(m => m.userCode, new { @readonly="readonly" })
You are welcome to make an HTML Helper for this, but this is simply just an HTML attribute like any other. Would you make an HTML Helper for a text box that has other attributes?
这篇关于如何在ASP.NET MVC3剃刀创建只读文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文