tags:

views:

28

answers:

1

Hi all, am new to MVC but have a Q about PartialViews. I have two PartialViews accessing Model Data from the ParentView (Model Data passed through via the ParentView's Controller). The first PartialView is used to update (add/delete values) Model Data to the database. The second PartialView generates a document based on the ParentsView Model Data. The problem is that if the data is changed in the database by the first PartialView then the ParentViews Model Data is now out of date and hence the Second PartialView (referencing the ParentsView Model Data) is now working with out of date data.

I realise the above should be re-engineered to to better suite, however is there a way to make the updated Model Data available at the ParentView level for the second PartialView to reference?

A: 

Usually in order to update something into the database an HTTP request is sent to the server and the controller action performs the update and renders a view meaning that the whole page is reloaded and the model data updated.

If you perform an AJAX request to update the database then you might need to update the second partial view as well so that changes are taken into account.

Darin Dimitrov
Darin, thats pretty much what I want to do but the question is how or what would be the correct 'MVC' way? I could cause a refresh of the ParentView which, in calling its Controller, would retrieve the latest data and send it to the page (Model object). But having a PartialView update another PartialView is against MVC practice? If not how could I make the updated information to the second PartialView without a page refresh (PartialViews cant update ParetnView Model Objects)?
sal