Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want to render an action from my master template.
In my mastertemplate:
@Html.Action("BoxLogin")
My Controller called "BoxLoginController":
public class BoxLoginController : Umbraco.Web.Mvc.SurfaceController { [HttpGet] public ActionResult BoxLogin() { return PartialView("BoxLogin"); } }
My BoxLogin view:
@{ Layout = null;}This is my Boxlogin
When I just do this I get an error:
Ok, so I override the global.asax:
protected override void OnApplicationStarting(object sender, EventArgs e) { base.OnApplicationStarting(sender, e); RouteTable.Routes.MapRoute( "BoxLogin", // Route name "{controller}/{action}", // URL with parameters new { controller = "BoxLogin", action = "BoxLogin" } // Parameter defaults ); }
Now My page renders ONLY the BoxLogin and not the HTML in my template...sigh...
Any tips for me?
I tried to delete this topic, because it was too noob-like, but this forum is buggy and would not delete it.
Well as you may notice it was a stupid routing mistake.
With this route it worked:
RouteTable.Routes.MapRoute("BoxLogin", "BoxLogin/BoxLogin", new { controller = "BoxLogin", action = "BoxLogin" });
Normally you don't need to map the SurfaceController. Umbraco will do this for you.
Can you change the call to your action to include the controller like this :
@Html.Action("BoxLogin","BoxLogin")
After the first post I did correct action as you suggest.
Regarding SurfaceController, I read that when you need to do postbacks then you need to inherrit from that?
What is SurfaceController used for then?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
How to render action from mastertemplate?
I want to render an action from my master template.
In my mastertemplate:
@Html.Action("BoxLogin")
My Controller called "BoxLoginController":
public class BoxLoginController : Umbraco.Web.Mvc.SurfaceController
{
[HttpGet]
public ActionResult BoxLogin()
{
return PartialView("BoxLogin");
}
}
My BoxLogin view:
@{
Layout = null;
}
This is my Boxlogin
When I just do this I get an error:
No route in the route table matches the supplied values.
Ok, so I override the global.asax:
protected override void OnApplicationStarting(object sender, EventArgs e)
{
base.OnApplicationStarting(sender, e);
RouteTable.Routes.MapRoute(
"BoxLogin", // Route name
"{controller}/{action}", // URL with parameters
new { controller = "BoxLogin", action = "BoxLogin" } // Parameter defaults
);
}
Now My page renders ONLY the BoxLogin and not the HTML in my template...sigh...
Any tips for me?
I tried to delete this topic, because it was too noob-like, but this forum is buggy and would not delete it.
Well as you may notice it was a stupid routing mistake.
With this route it worked:
RouteTable.Routes.MapRoute("BoxLogin", "BoxLogin/BoxLogin", new { controller = "BoxLogin", action = "BoxLogin" });
Normally you don't need to map the SurfaceController. Umbraco will do this for you.
Can you change the call to your action to include the controller like this :
@Html.Action("BoxLogin","BoxLogin")
After the first post I did correct action as you suggest.
Regarding SurfaceController, I read that when you need to do postbacks then you need to inherrit from that?
What is SurfaceController used for then?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.