The ReadOnly attribute does not seem to be in MVC 4. The Editable(false) attribute does not work the way I would want it to.
Is there something similar that works?
If not then how can I make my own ReadOnly attribute that would work like this:
public class aModel
{
[ReadOnly(true)] or just [ReadOnly]
string aProperty {get; set;}
}
so I can put this:
@Html.TextBoxFor(x=> x.aProperty)
instead of this ( which does work ):
@Html.TextBoxFor(x=> x.aProperty , new { @readonly="readonly"})
or this ( which does work but values are not submitted ):
@Html.TextBoxFor(x=> x.aProperty , new { disabled="disabled"})
http://view.jquerymobile.com/1.3.2/dist/demos/widgets/forms/form-disabled.html
something like this maybe? https://stackoverflow.com/a/11702643/1339704
Note:
[Editable(false)] did not work