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

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

C# MVC Razor page form 0
ASP.NET MVC 3
ASP.Net MVC RC DropDownList 3
ASP.NET MVC DropDownList ... What am I doing wrong? 2
MVC TempData Nighmare 1
MVC 4
asp.net mvc 3
MVC - ViewData 0

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top