The problem in Html.ActionLink() is that you can\'t add additional html content inside the tag that it generates. For example, if you want to add an icon besides the text l
You can use this Url.Action("actionName", "controllerName", new { Area = "areaName" });
Also don't forget to add the namespace of the controller to avoid a conflict between the admin area controller names and the site controller names.
Something like this
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new[] { "Site.Mvc.Areas.Admin.Controllers" }
);
}
@Url.Action("{action}", "{controller}", new { Area = "areaname" });
@Html.ActionLink("LinkName", "{action}", "{controller}", new { area = "{areaname}"}, new { @class = "btn btn-cool" })
You can use above this
@Url.Action("{action}", "{controller}", new { Area = "areaname" });
@Html.ActionLink("LinkName", "{action}", "{controller}", new { area = "{areaname}" }, new { @class = "btn btn-cool" })
write area name as html attribute with anonymus object. you can use actionlink html helper extension method to achieve same thing.