For a very long time, I thought applying the ReadOnly
attribute to a viewmodel property meant that the generated element would have the readonly
HTML attribute.
Then I was very dissapintd to discover that this ReadOnly
attribute only applied to model binding, and that the value in a read-only input isn't bound to the posted viewmodel, and people could still type in the UI field, letting them think the value would be stored.
Now I have to go through my viewmodel, and wherever there is this attribute, comment it out, and manually apply the HTML readonly
attributes to the Razor elements affected.
I would now like to make a ReallyReadOnly
attribute, so that for viewmodel properties marked as such, a genuine read-only input is generated, and its value is bound back to the posted view model
Where can I, if I can, in the rendering process, can I check for and act on this new attribute?