views:

86

answers:

3

Hello,

I am using PartialView object for all the CRUD operations in my project.

I would like to return from more than one action (Create/Read/Edit) always the same PartialView that I have previously binded to the correct model object.

How can I achieve this?

Thanks

+1  A: 

Just add this to the end of every action that you want the partial returned from

return PartialView("PartialViewName", yourModelName)
Doozer1979
+2  A: 

You can specify, which (Partial)View you want to return from an action like this:

return PartialView("ViewName", viewModel);

If you want to use the partial view from different controllers, then put it in the Views/Shared folder.

Dave
Different controllers surely, not actions?
Doozer1979
If you use different actions in the same controller, then you can let it in the corresponding view folder (e.g. ServicesController -> Views/Services). You only have to put it in the Shared folder, if you want to access it from different controllers. But even if it's not in the Shared folder, you could provide the full path to the view `return View(...)` statement.
Dave
Intellisense does not showed the other constructor....
Lorenzo
Which 'other constructor' do you mean?
Dave
A: 

Just do it. Add Create, Edit, and delete views and have each of them Render the partial view where you want it.