Questions tagged [child-actions]

33 questions
1
vote
2 answers

MVC Component with postback

I am trying to build a set of MVC components which can be easily reused with various settings. They are built and used as child actions, because I need them to be able to make partial postback to themselves without the knowledge of the other content…
martinh_kentico
  • 913
  • 7
  • 17
1
vote
2 answers

Make all action methods of a controller ChildActionOnly

Instead of having to remember to decorate a bunch of action methods with the ChildActionOnly attribute, it would be convenient to be able to specify all methods in an entire controller as such. Trying to put the ChildActionOnly attribute on the…
ErikE
  • 48,881
  • 23
  • 151
  • 196
1
vote
1 answer

MVC 4 child action's outputcache attribute not working with VaryByParam value

Is it not possible to cache a child action's output depending on query value? public class HomeController : Controller { public ActionResult About() { ViewBag.Message = DateTime.Now.ToLongTimeString(); return View(); } …
Erhan
  • 41
  • 1
  • 6
1
vote
1 answer

Error executing child request for handler

I use a child action in Home Controller like this: [OutputCache(Duration=30)] public ActionResult ChildAction() { Response.Write("Date Time is="+DateTime.Now); return View(); } Home.cshtml

About

1
vote
1 answer

Child Action Exception Handler

I have a simple Controller: public class RedirectController : Controller { public ActionResult Index() { return View(); } [ChildActionOnly] public ActionResult Child1() { return View(); } [ChildActionOnly] …
xling
  • 252
  • 1
  • 9
0
votes
0 answers

Replace ChildActionExtensions.Action with a ViewComponent?

I've had no problem replacing "ChildActionExtensions.RenderAction" with a "ViewComponent", but I haven't figured out how to replace the (arguably simpler) "ChildActionExtensions.Action". I just want to return some HTML, not a view. I'm sure this…
Bradley Plett
  • 163
  • 1
  • 11
0
votes
2 answers

MVC3 Model Binding in the way of my Child Action Method

I am using MVC3 and am trying to leverage the Child Action feature @Html.Action() so I have a View with the following @foreach (var item in Model.Items){ @Html.Action("GetFormItemView", "Question", item}); } This calls the…
0
votes
1 answer

Logic for Partial Views Used Across an App

How do I associate a PartialView which will be used across the app with a Child Action? For example the PartialView could be a login bar at the top of the page which will need to have some associated logic (loading the model etc) which I would…
Judo
  • 5,167
  • 3
  • 24
  • 34
0
votes
1 answer

Understanding the process of loading a ChildAction

This is for a recruitment website: I have a form which displays the job and there is an Apply button. If user click on Apply a pop-up will open, where user clicks his info and clicks on Send button: When user clicks on Apply a modal will open...…
Hooman Bahreini
  • 14,480
  • 11
  • 70
  • 137
0
votes
0 answers

Unable to cast object of type 'System.Web.Mvc.ViewResult' to type 'System.Web.Mvc.PartialViewResult

I have Html.Action method i my layout.cshtml file, which rander search form on every page. In the layout file I have this condition rendering: @if (dcmodel != null) { @Html.Action("SearchForm", "Document", dcmodel) } else { …
Martin Haščák
  • 350
  • 6
  • 29
0
votes
0 answers

Calling ASP.NET MVC child action from the controller

In ASP.NET MVC views, it's possible to call child actions like this: @Html.Action("ActionName") That will render the results of the action called ActionName to the output of the view. Is it possible to make such child action call in the…
Tom Pažourek
  • 9,582
  • 8
  • 66
  • 107
0
votes
1 answer

Html.Action renders the partial menu inside with different link routes

I render a menu widget inside the header of a master layout. _Layout.cshtml @Html.Action("Menu", "Menu", new { area = "Application" }) FullMenu.cshtml
0
votes
1 answer

Get The Parent Controller from a PartialView Action

I have a _Partial.cshtml view which is called in a Parent.cshtml view in the following manner: Parent.cshtml: @Html.Render("_Partial"); In the _Partial.cshtml view, there is a button which is linked to a form in the following manner: using…
Duvarian
  • 177
  • 3
  • 10
0
votes
1 answer

Is there a good way to handle exceptions in MVC ChildActions

I seem to be doing a lot of Exception swallowing with Child Actions. [ChildActionOnly] [OutputCache(Duration = 1200, VaryByParam = "key;param")] public ActionResult ChildPart(int key, string param) { try { …
Peter
  • 7,792
  • 9
  • 63
  • 94
0
votes
0 answers

How have one child action & call it from multiple controller?

I have one Child action that call it from it's own controller & return Views/Shared/PartialViewName belong to my child action. again repeat this in another controller and it do the same. every thing is ok. but i reapet child action in some…
Mohammadreza
  • 3,139
  • 8
  • 35
  • 56