i’m working on a project which aim is to create a sort of social portal.
The matter is that i’ve an entity page detail where user can edit it or just view it.
I’m considering to create just one page and using that as view only and edit mode at the same time.
I had two ideas:
1) create an enumeration ControlBehaviour { EditMode, ViewMode } in Session and using that to understand if I have to set readonly every controls in my page;
2) use jquery to set readonly every controls in the page if i have to open it in viewmode (or not readonly if i have to open it in edit mode).
Does it exist any pattern to reach my aim?
best regards
Separating your concerns into read and edit forms is most suitable, in terms of maintaining your code afterwards, by yourself or for someone else.