0

I have started working with mvc3 pattern and am facing a problem.

The problem statement is some what as follows:

I have a partial view lets say MasterPartial which renders some content and is bound with a model named MasterPartialModel which contains all necessary data to display on that partial view. The MasterPartialView has nested partial views uptill n level and the nested child partial view that renders on demand within the MasterPartialView is bound with ChildPartialView.

Further more, the MasterPartial view has the form tag. Now my question is upon submit which model would i be receiving and upto my understanding it would be the model of the view which has the form declared within it. How would I know if a user makes a change in the data rendered by one of the childviews. How would I get models of the child view which were rendered on demand by the user, or simply how do we cater for this kind of a problem in MVC3 pattern?

Nick Larsen
  • 18,631
  • 6
  • 67
  • 96
Wajeeh
  • 111
  • 1
  • 7
  • The form will only submit the values within the controls bound within it, not the "Model" per say. – Lloyd Feb 29 '12 at 09:55
  • But as there are multiple controls bound to different models present on different views would they get accumulated into one model or what would i receive on the server on submit? – Wajeeh Feb 29 '12 at 10:02
  • If they are all within a single Form Element then yes you will get those values as well. Its HTML not ASP.Net or anything else, http://www.w3schools.com/html/html_forms.asp – Lloyd Feb 29 '12 at 10:04
  • :) i totally understand the point but that way i would have to get values from those fields using Request object in the controller rite, but then again i don't how many child panels were displayed or in simple terms what to expect on the server end i am looking for a way to receive everything in the form of a model a single element so i don't have to run into running loops. – Wajeeh Feb 29 '12 at 11:43

1 Answers1

0

Fixed the issue by working around the problem and by using jquery to go through all the loaded partial views. Collected all the values required filled an array of the type of a model and sent that array of models to the controller method for processing. :) jquery i awesome specially if coupled with mvc...

Wajeeh
  • 111
  • 1
  • 7