Questions tagged [renderaction]

RenderAction is an ASP.NET MVC helper method, available starting in the 2nd version, that calls from a view and outputs the results of the action in place within the view.

130 questions
1079
votes
13 answers

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction

In ASP.NET MVC, what is the difference between: Html.Partial and Html.RenderPartial Html.Action and Html.RenderAction
Ghooti Farangi
  • 19,926
  • 15
  • 46
  • 61
43
votes
3 answers

Equivalent of Html.RenderAction in ASP.NET Core

I am trying to switch to ASP.NET Core from my small ASP.NET MVC 4 application. In my MVC 4 application, I have a Layout file that uses RenderSection as: @RenderSection("xyz", required: false) Then, in my Index file, I have: @section xyz{ …
user6542823
  • 1,396
  • 2
  • 14
  • 24
35
votes
12 answers

Error executing child request for handler in view

I have an MVC 4 view where I render the following actions @{ Html.RenderAction("Index", "Logo"); Html.RenderAction("Index", "MainMenu"); } I have a form on my view which is filled out and posted to the controller. In the controller I…
Andre Lombaard
  • 6,985
  • 13
  • 55
  • 96
29
votes
2 answers

MVC5 Html.RenderAction with different controller

I am starting with MVC5 and created first project from MVC5 Getting Started. Now trying with Partial Rendering and added a method in MoviesController as below [ChildActionOnly] public ActionResult PriceRange() { var maxprice = db.Movies.Max(m =>…
SamTech
  • 1,305
  • 2
  • 12
  • 22
14
votes
6 answers

Asp.Net MVC2 RenderAction changes page mime type?

It appears that calling Html.RenderAction in Asp.Net MVC2 apps can alter the mime type of the page if the child action's type is different than the parent action's. The code below (testing in MVC2 RTM), which seems sensible to me, will return a…
Gabe Moothart
  • 31,211
  • 14
  • 77
  • 99
8
votes
1 answer

What's the current practice for partial caching in ASP MVC2?

My website pages are composed of two kinds of content. The first is variable between users but constant for all pages. The second is constant across users, but variable between pages. This is a common layout. What is the best way to apply output…
8
votes
1 answer

How can I get Html.RenderAction to call the Get method on a Post?

After rendering a view on a Post, a call to RenderAction inside the view will call for the Post method. Is there any way to specify I want to call the Get method instead of the Post?
godhandiscen
  • 85
  • 2
  • 6
7
votes
4 answers

Asp.Net MVC 3 - @Html.Action won't render/return any HTML

I've been moving a fairly new project from ViewPages to Razor today, and all seems to be going well. Except I'm trying to use Html.Action to render a user control and it won't render anything. So I have a Shared/_Layout.cshtml file which is…
Steve Owen
  • 2,022
  • 1
  • 20
  • 30
7
votes
1 answer

RenderAction differences

Why is this code correct: @{ Html.RenderAction("PostImagesForPost", "BlogPost", new { id = Model.ID }); } And this code @Html.RenderAction("PostImagesForPost", "BlogPost", new { id = Model.ID }) through this error message: Compiler Error…
POIR
  • 3,110
  • 9
  • 32
  • 48
7
votes
3 answers

ActionFilterAttribute: Where is the 'Cancel' property?

Whatever happened to the Cancel property on the ActionExecutingContext? How would one abort a RenderAction when using an ActionFilterAttribute or is there another way to skin this cat? public override void OnActionExecuting(ActionExecutingContext…
7
votes
2 answers

should I be using an @html.renderpartial or @html.renderaction

I'm trying to bring in my menu. In my _Layout.cshtml page I have
@Html.RenderAction("Navigation", "Nav") The Nav Controller looks like this public ActionResult…
haydnD
  • 2,225
  • 5
  • 27
  • 61
6
votes
2 answers

active admin render edit page

I can easily redirect but I'd like to do a render the edit page on validation failure so I carry over all the validation methods into the form. I'm not sure how to render the edit action using active_admin. If I try render :action => 'edit' I get…
holden
  • 13,471
  • 22
  • 98
  • 160
6
votes
4 answers

RenderAction calls wrong action method

I'm struggling with renderaction, the problem is that it calls the wrong action method on my controller. On my "Users" controller there are two action methods called edit, one for get and one for post requests: public virtual ActionResult Edit(int…
Adrian Grigore
  • 33,034
  • 36
  • 130
  • 210
6
votes
1 answer

Html.RenderAction using AJAX

Is it possible to use HTMl.RenderAction using ajax to provide the parameter? I have a controller action like this [ChildActionOnly] Public ActionResult EmployeeData(string id) { Employee employee = new Employee(); //do work to get data …
twal
  • 6,999
  • 17
  • 48
  • 58
6
votes
1 answer

Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction. can any one please describe the difference

In ASP.NET MVC, what is the difference between: Html.Partial and Html.RenderPartial Html.Action and Html.RenderAction
Nikhil Saswade
  • 167
  • 2
  • 6
  • 16
1
2 3
8 9