views:

42

answers:

1

We are starting a new ASP.NET MVC project and we would like to establish a pattern of development that will allow flexibility in the UI. The general idea is that we would like to develop a set of related controls as a unit (i.e. a set of inputs and a submit button) and maintain the flexibility to decide later 1 of 3 UI options

  1. Have that set of controls with its submit button be alone on a web page, OR
  2. Have the set of controls be together with other sets of controls on the same page, and each set has its own submit button, OR
  3. Have the set of controls be together with other sets of controls on the same page, but there is only one submit button for the whole page

Is there any pattern or strategy of development that would allow us to develop with this flexibility?

+2  A: 
  1. I would create a Partial view for this scenario. Just lay out the form in your Partial view and drop it into whichever view you see fit.
  2. Since the entire body is not wrapped in a form tag like WebForms, there is no limit to the number of forms you can use on a page as long as they're not nested.
  3. This one is a bit tougher. Unlike WebForms where you could put controls all over the page and have a button click collect those you can't do that with MVC. Your options would be to make sure the inputs are within a form or use JavaScript to collect all the values and submit those.
DM