render admin partial view from plugin

1 个月 前
I use these codes to load an admin partial view from plugin but none of them worked:

@await Html.PartialAsync("~/Areas/Admin/Views/Shared/Table.chtml", gridModel)


@await Html.PartialAsync("~/Areas/Admin/Views/Shared/Table", gridModel)


@await Html.PartialAsync("../../Areas/Admin/Views/Shared/Table.chtml", gridModel)


would you please tell me the correct code? I have searched about 3 hours but not find the correct answer.
1 个月 前
I dont have any models but I use this
            @await Html.PartialAsync("~/Areas/Admin/Views/Shared/Notifications.cshtml")
When you say it does not work did you set a break point on some code in the file to see if is being loaded ?
1 个月 前
Yidna wrote:
I dont have any models but I use this
            @await Html.PartialAsync("~/Areas/Admin/Views/Shared/Notifications.cshtml")
When you say it does not work did you set a break point on some code in the file to see if is being loaded ?


it shows this error: InvalidOperationException: The partial view '~/Areas/Admin/Views/Shared/Table.chtml' was not found. The following locations were searched: ~/Areas/Admin/Views/Shared/Table.chtml

for extra information(I don't know is it important or not): I am overriding this route: Admin/Order/List with routeProvider:

public void RegisterRoutes(IEndpointRouteBuilder endpointRouteBuilder)
    {
      endpointRouteBuilder.MapControllerRoute("orderList", "Admin/Order/List", new
      {
        controller = "OOrder",
        action = "List"
      }, null, null);
      
    }

          public int Priority
    {
      get
      {
        return 1;
      }
    }


my override action hit and goes to view, but in partial view line it forces error.
1 个月 前
sepehrland wrote:
@await Html.PartialAsync("~/Areas/Admin/Views/Shared/Table.chtml", gridModel)


Where is the actual file to load - Is it in ~/Areas/Admin/Views/Shared/ ?
Or if it is the Plugin directory then try the plugin path
"~/Plugins/Group.Name/Views/Shared/Table.cshtml"
1 个月 前
Yidna wrote:
@await Html.PartialAsync("~/Areas/Admin/Views/Shared/Table.chtml", gridModel)


Where is the actual file to load - Is it in ~/Areas/Admin/Views/Shared/ ?
Or if it is the Plugin directory then try the plugin path
"~/Plugins/Group.Name/Views/Shared/Table.cshtml"


Presentation\Nop.Web\Areas\Admin\Views\Shared\Table.cshtml