-1

I really don't understand the usage of Html.Action(string,object) its return type is HTMl string so why do we even need it? and whats its relation with partialviewresult ? I have seen some people using @html.action(String actionname,Object routeobject); in any of their view and controller invoked by this method returns a partialviewresult whats that ?

WaqarUlKhaf
  • 43
  • 1
  • 4
  • 1
    Please note that the model-view-controller tag is for questions about the pattern. There is a specific tag for the ASP.NET-MVC implementation. –  Jul 02 '16 at 23:33
  • I understand that thanks for notifying anyway! – WaqarUlKhaf Jul 03 '16 at 12:14

1 Answers1

0

Firstly, HtmlString represents an HTML-encoded string that should not be encoded again. HtmlString Class

There is a answer that I believe is good from this question:

@Html.Action and @Html.RenderAction are used when your partial view model are independent from parent model, basically it is used when you want to display any widget type content on page. You must create an action method which returns a partial view result while calling the method from view.

More, use Html.Action when you actually need to retrieve additional data from the server to populate the partial view

Please have a look at the documentation for more detailed information.

More questions about the same topic:

How can I use Html.Action?

MVC Html.Partial or Html.Action

Maybe a bit of research before posting a question would be better

Community
  • 1
  • 1
Murilo Santana
  • 520
  • 1
  • 5
  • 13