Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC project what is the difference between PartialViewResult, ActionResult,ViewResult classes?

MVC project what is the difference between

PartialViewResult

ActionResult

ViewResult

classes?

can anyone post brief introduction link?

like image 242
Neo Avatar asked Sep 01 '25 09:09

Neo


2 Answers

  • ActionResult - an abstract class that all actions in an ASP.NET MVC application should return a concrete instance of.
  • ViewResult - an implementation of ActionResult that is used to render a view using the specified view engine
  • PartialViewResult - an implementation of ActionResult that is used to render a partial view (without a layout) using the specified view engine
like image 118
Darin Dimitrov Avatar answered Sep 04 '25 02:09

Darin Dimitrov


Here are some resources to get you started:

The MSDN documentation for the ActionResult class can be viewed here.

ActionResult types in MVC2 is a good introduction.

ASP.NET MVC ActionResults explained is some more information.

What's the point of ActionResult return type? link refers to another Stack Overflow post.

Difference Between ViewResult() and ActionResult() is another.

like image 32
Benjamin Gale Avatar answered Sep 04 '25 02:09

Benjamin Gale