Open Closed

switch layouts in razor pages #5368


User avatar
0
Andy created

Hi,

I am using the commercial LeptonX themes and get some questions.

  1. The default layout for my razor page website is Application, but for some pages, I have to use the Account layout (such as the signin and registration pages). Can you please let me know how I can achieve this?

  2. Can you please let me know where I can find the source code of the custom pages from demo site: https://x.leptontheme.com/side-menu/custom-pages/blog I have downloaded the source code of the LeptonX pro theme but don't find them there.

Thank you.

  • ABP Framework version: v7.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

3 Answer(s)
  • User Avatar
    0
    Andy created

    OK, I figure out can use the code below to change the layouts in the pages. are there easier /

    @{ Layout = "~/Themes/LeptonX/Layouts/Account/Default.cshtml"; }

    or put the code into a _ViewStart page

  • User Avatar
    0
    nlachmuthDev created

    Hi there,

    You can also use the ThemeManager to set the required Theme:

    @inject IThemeManager ThemeManager
    @{
        Layout = ThemeManager.CurrentTheme.GetApplicationLayout();
        //Or account layout
        //Layout = ThemeManager.CurrentTheme.GetAccountLayout();
    }
    

    But as you found out setting the string to the Theme fully qualified inside your pages works too.

    Kind regards

  • User Avatar
    0
    Andy created

    thanks! all good now.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11