asp.net-mvc advice on when to break up one view into multiple views
I am designing the "Create" functionality for a pretty complex order object. In the process of creating an order, the user will have to select a receiver (via a person search), select items for the order (again, via an item lookup), and enter other details about the order.
The original idea for designing this is to have several 'tab' links that show/hide corresponding DIVs, to have search functionality in a partial view, reused in two divs, and to update the search results using ajax, so that an entire order c开发者_如何学Goan be created without multiple posts to server, only using some ajax calls to get data, to limit load on server.
This seems like the ASP.NET way of designing things, and I have a feeling that this create process should be separated into multiple views.
What do you think? Is this getting too complex for one View in the MVC pattern?
thanks!
Complexity does factor in; if it's hard to build, it will be harder to maintain.
As a starting point, consider the contents of each tab as a separate view. The visual organization of the page is probably a good guide on separating functionality and content into separate views.
DRY (Don't Repeat Yourself).
Generally, its not really about the complexity of a View (though that does factor in) but what parts/portions of that view will/could be used in other locations? If you have a part that duplicates functionality in another part of your site, create a partial view for it.
EDIT
Seeing the next answer, I realized I missed the tabs part of your question. I agree with the poster below, separate your tabs into partial views. Most likely, it would make sense to make each tab will be it's own action on your controller and a corresponding partial view result.
精彩评论