I have a model which is reading data from the database and using Html.Editors to display that info. However on this one data element, the project owners want the users to only be able to edit the last two characters of the data element. Is it possible
to limit the editable portion of somethin using an editorFor? Or do I have to add two additional properties to the view’s model and show a displayFor and an EditorFor back to back? Will that look like it’s one data element?
Or do I have to add two additional properties to the view’s model and show a displayFor and an EditorFor back to back? Will that look like it’s one data element?
I split the text in the Action and apply the contents to two new properties in the Model and use a displayfor and a textboxfor to show the data. (I used a text box for because I found that you could not alter the width of an editorfor. As it is I found a
style class in the textboxfor had no effect even though it is supposed to. I had to set an inline style in the textboxfor’s second parameter.
Or have one editor, in your controller action method check if other than last 2 characters are modified, If Yes make Model.Isvalid = false and return the object to view and show that only last 2 can be edited
You can also have 2 properties, display for and editor for but its difficult to style those as one single word
@syed.iddi I do not understand what you are suggesting. Could you provide a code example please?