且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ASP.NET MVC3剃刀创建只读文本框

更新时间:2022-12-20 12:15:15

  @ 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?