KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The Add view and the Edit view are often incredibly similar that it is unwarranted to write 2 views. As the app evolves you would be making the same changes to both. However, there are usually subtle differences. For instance, a field might be read-only once it's been added, and if that field is a DropDownList you no longer need that List in the ViewData. So, should I create a view data class which contains all the information for both views, where, depending on the operation you're performing, certain properties will be null? Should I include the operation in the view data as an enum? Should I surround all the subtle differences with <% if( ViewData.Model.Op == Ops.Editing ) { %> ? Or is there a better way?
Tags (comma-separated)
Save Edits
Cancel