Questions tagged [child-actions]
32 questions
32
votes
2 answers
Does a child action share the same ViewBag with its "parents" action?
I am confused with this:
I have an action ,say Parent ,and in the corresponding view file ,I have called a child action ,say Child ,both Parent and Child actions are in the same controller.
and I need the Child action and the Parent action to share…
NextStep
- 925
- 3
- 11
- 18
13
votes
1 answer
How can I tell if my action is being called by RenderAction?
I have an action that could potentially be called via a normal link, in which case I'd return a View(), or it could also be called via AJAX or RenderAction (ie as a Child Action) in which case I'd return a PartialView().
Sorting out the AJAX part is…
StanK
- 4,680
- 2
- 19
- 46
6
votes
3 answers
ASP .Net MVC 3: Child Action and Redirect
I need to display the registration form and login form on the home page.
If validation fails on these two forms, I need to display proper errors on the home page.
But if there was no error, the user must be redirected to the secured Dashboard.
To…
Moon
- 27,583
- 17
- 73
- 122
5
votes
1 answer
MVC3 Why do I get "Child actions are not allowed to perform redirect actions" error?
I got an action List
//[HttpGet] (will come back to that!)
public ViewResult List(int page = 1)
{
//blah blah blah
return View(viewModel);
}
In its view we render action:
@{
…
Mariusz.W
- 1,327
- 12
- 19
4
votes
1 answer
Posting data back to ASP.NET MVC child actions
Since we can compose a single view from a main view + a partial view (e.g. using RenderAction, specifying a child controller), is it possible for input rendered by the child action to be directed to the child controller while input rendered by the…
Craig Boland
- 874
- 1
- 9
- 16
4
votes
1 answer
ASP.NET MVC3 Html.Action containing a form
I have a pod on my page that contains a form.
I have used this pod in a similar way to the following:
@Html.Action("Pod","Home")
There is some business rule checking in the Pod's HttpPost action which handles the form post. If this business rule…
Rob Stevenson-Leggett
- 33,849
- 21
- 84
- 138
4
votes
3 answers
MVC OutputCache for Child Actions: where is it stored?
I'm using OutputCache for caching an horizontal menu and a vertical menu in my app. I usually use something like this in the actions I want to be cached
[OutputCache(Duration=3600, VaryByParam="none", Location=OutputCacheLocation.Client,…
snekkke
- 411
- 5
- 15
3
votes
1 answer
Asp.Net mvc nested actions HTTPPOST
i ve got a weird problem. My view :
@{
ViewBag.Title = "Index";
}
Index
@using(Html.BeginForm()) { } @Html.Action("Index2") My Controller: public class DefaultController : Controller { // …
armless-coder
- 95
- 1
- 9
2
votes
0 answers
Pass data to child action's view
I have multiple views which call the same child action, which renders a view.
Depending on which view calls the child action, I want to display a different message in the childview. But since I don't need this view inside the child action's…
TDaver
- 7,024
- 5
- 44
- 91
2
votes
0 answers
Using Azure Redis Caching for ChildAction in MVC 5
I have successfully implemented Azure Redis Cache using the Microsoft RedisOutputCacheProvider which works as expected for general pages.
However, I can't seem to get it to work for child actions, it always use the default OutputCacheProvider.
How…
TyKonKet
- 182
- 2
- 5
- 13
2
votes
1 answer
Caching in ASP.NET MVC with uncachable forms
I'm doing donut caching with the MVCDonutCaching library.
Background to donut caching using this library:
The way it works, is you can cache a view, but exclude part of it from being cached, i.e. the "donut hole". You do this by having the…
h bob
- 3,162
- 2
- 26
- 49
2
votes
1 answer
Azure Redis Cache and MVC Child Actions
I have successfully implemented Azure Redis Cache using the Microsoft RedisOutputCacheProvider from NuGet which works as expected for general pages.
[ChildActionOnly]
[ChildActionOutputCache(CacheProfile.StaticQueryStringComponent)]
public…
Sam Gooch
- 131
- 1
- 4
2
votes
1 answer
Handling Errors in MVC Child Actions
My error handling collects (some manually, some automatically) the errors produced during controller execution. Then I have a partial view which renders out the error messages.
I store the error messages in ViewData (and transfer them to TempData…
TDaver
- 7,024
- 5
- 44
- 91
1
vote
1 answer
ASP.NET MVC3: 2 forms on page, submit triggers the wrong one
I have 2 forms on the same page. One is a form in a partial view which is rendered via a child action we'll call this PodForm. The second is rendered by the current action.
So my code looks a little like this (please ignore names etc, this is…
Rob Stevenson-Leggett
- 33,849
- 21
- 84
- 138
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
- 733
- 5
- 15