@Html.Action not working in Admin Plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
I have an custom admin plugin for which I need to build a dashboard.cshtml page just like the current admin dashboard page. I need to use a @html.Action( tag for showing a custom action in that page. But I found that @Html.Action is not working in my page. I have already made the maproute function which inclue 5 string url for admin plugin and also included this : "DataTokens.Add("area", "admin")" . Everything else in the custom admin plugin is working.

it is not working for only  admin views. Outside of admin it is working.


View:
both of the following code not working within admin views:
@Html.Action("UponTotalReport", "Upon")
@Html.Action("UponTotalReport", "/Plugin/Upon/uPonDashboard/")

action in my controller:

[ChildActionOnly]
        public ActionResult UponTotalReport()
        {
            var model = GetUponTotalReportModel();
            return PartialView("Nop.Plugin.Upon.Views.Upon.UponTotalReport", model);
        }

Can anyone from Nopcommerce team help?
11 years ago
Mouri wrote:
I have an custom admin plugin for which I need to build a dashboard.cshtml page just like the current admin dashboard page. I need to use a @html.Action( tag for showing a custom action in that page. But I found that @Html.Action is not working in my page. I have already made the maproute function which inclue 5 string url for admin plugin and also included this : "DataTokens.Add("area", "admin")" . Everything else in the custom admin plugin is working.

it is not working for only  admin views. Outside of admin it is working.


View:
both of the following code not working within admin views:
@Html.Action("UponTotalReport", "Upon")
@Html.Action("UponTotalReport", "/Plugin/Upon/uPonDashboard/")

action in my controller:

[ChildActionOnly]
        public ActionResult UponTotalReport()
        {
            var model = GetUponTotalReportModel();
            return PartialView("Nop.Plugin.Upon.Views.Upon.UponTotalReport", model);
        }

Can anyone from Nopcommerce team help?


Try this:

@Html.Action("UponTotalReport", "Upon", new RouteValueDictionary() 
        {
            { "namespaces", "PLUGIN_CONTROLLER_NAMESPACE" },
            { "area", null }
        })


Replace PLUGIN_CONTROLLER_NAMESPACE with the namespace of your plugin controller, for example Nop.Plugin.Upon.Controllers. :D
11 years ago
Thanks a lot. It is working :)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.