ASP.NET MVC - Html.RenderPartial and Html.RenderAction

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

Consider I have a view named Contact.

When should I use a component (Html.RenderAction) or a partial view
(Html.RenderPartial) to add a "block" to it?

I have been using components and they have their own ViewData ...

But isn't true that I can also include that ViewData into Contact
ViewData and then pass it to the Partial View using
Html.RenderPartial?

So isn't the same?

I am just trying to set some rules of how to decide when develop a new
Html.Helper, use an Html.RenderAction or use an Html.RenderPartial in
my projects ...

Any help is welcome.

Thanks,

Miguel
 
its the same decision when choosing between coding a usercontrol (*.asc) and
a real webcontrol (*.cs).

the more you want to package and reuse the code, it the stonger the arg to
use an action rather than loading a usercontrol.


-- bruce (sqlwork.com)
 
Back
Top