nopCommerce 4.0 Plugin admin page not able to load _AdminLayout page

2 years ago
I am trying to upgrade one of my plugin from 3.9 to 4.0. In 4.0 version I have successfully installed the plugin. My Plugin has an admin page and the link is also coming properly in admin menu section and getting loaded without admin layout page. Every time I added the admin layout its throwing an error.


@{
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
    }



when using this  its saying

An unhandled exception occurred while processing the request.
InvalidOperationException: The view 'Components/AdminLanguageSelector/Default' was not found. The following locations were searched:
/Themes/DefaultClean/Views/BulkProductEdit/Components/AdminLanguageSelector/Default.cshtml
/Themes/DefaultClean/Views/Shared/Components/AdminLanguageSelector/Default.cshtml
/Views/BulkProductEdit/Components/AdminLanguageSelector/Default.cshtml
/Views/Shared/Components/AdminLanguageSelector/Default.cshtml


and

@{
    Layout = "_AdminLayout";
}


and when using this saying cannot find "_AdminLayout"


please help me out. Thanks in advance.
2 years ago
Your cshtml should has

@{
    Layout = "_AdminLayout";
}

and your controller should decorated by area(admin). Your link should be inside \Admin\ path
2 years ago
@ahmadkq thaks for the reply. That problem I have solved.

Actually I was missing admin area declaration inside ManageSiteMap method. Thats why its not allowing admin layout page to render.
8 months ago
Hi ,
I am facing the same problem:

Would you please explain how you manage to solve it
8 months ago
mhdeyad wrote:
Hi ,
I am facing the same problem:

Would you please explain how you manage to solve it


_AdminLayout can be used as page layout when you are in Admin area route. Make sure that your your controller class inherited BaseAdminController, or simply put [Area(AreaNames.Admin)] on top of the controller.