Open Closed

Using Blazor Components in overridden Abp cshtml page #2563


User avatar
0
balessi75 created

Hi, We are using Abp Commercial 5.1.3 - Blazor Server. We need to override Abp's Register.cshtml page which we have successfully done.

We have a requirement, however, to utilize an existing Blazor Component (Telerik UI for Blazor) in the overriden Register.cshtml page in our Blazor Server solution. By default this does not appear to be possible because the Register page is an MVC page. Is it possible to accomplish this? And if so, what would be the steps to make this scenario work?

Thanks in advance, balessi75


8 Answer(s)
  • User Avatar
    0
    gterdem created
    Support Team Senior .NET Developer

    Can using Telerik UI for MVC/Razor be an option? If so Cusomize Login Page article may help.

  • User Avatar
    0
    balessi75 created

    Can using Telerik UI for MVC/Razor be an option? If so Cusomize Login Page article may help.

    Thanks @gterdem. I will give that a try and post whether or not this solution works...

  • User Avatar
    0
    balessi75 created

    Can using Telerik UI for MVC/Razor be an option? If so Cusomize Login Page article may help.

    Not sure this is possible with a Blazor Server Abp solution. In looking at this community article...

    https://community.abp.io/posts/how-to-integrate-the-telerik-ui-for-asp.net-core-kendo-components-with-the-abp-mvc-ui-u2voab2a

    ...there seems to be a lot of configuration needed for a MVC solution. For example, creating .js and bundling configurations in the .Web project, but our Blazor Server templated Abp solution has no .Web project.

    Thoughts?

  • User Avatar
    0
    gterdem created
    Support Team Senior .NET Developer

    So I am guessing you are non-tiered Blazor server application.

    Doesn't matter, you can use Blazor.Server project instead of Web. Blazor-Server has similar structure with MVC/Razor web application. MVC cshtml pages can run along with razor pages. Same configurations for bundling applies. You will be overriding Account/Register page which is already an MVC page.

  • User Avatar
    0
    balessi75 created

    So I am guessing you are non-tiered Blazor server application.

    Doesn't matter, you can use Blazor.Server project instead of Web. Blazor-Server has similar structure with MVC/Razor web application. MVC cshtml pages can run along with razor pages. Same configurations for bundling applies. You will be overriding Account/Register page which is already an MVC page.

    Yes, this is a non-tiered Blazor server application.

    We are following the community article: https://community.abp.io/posts/how-to-integrate-the-telerik-ui-for-asp.net-core-kendo-components-with-the-abp-mvc-ui-u2voab2a

    We are stuck at the step: In the abp.resourcemapping.js file, add the necessary entries that look like the following:

    module.exports = {
        aliases: {
        },
        mappings: {
            "@node_modules/@progress/kendo-ui/css/**/*": "@libs/kendo/css",
            "@node_modules/@progress/kendo-ui/js/**/*": "@libs/kendo/js"
        }
    };
    

    ... because our Blazor Server solution created from Abp Suite has no abp.resourcemapping.js file. If we attempt to create one in our Blazor project, we get compile time errors...

    Error CS0103 The name 'module' does not exist in the current context

    Any help is much appreciated.

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi @balessi75

    You can create abp.resourcemapping.js manually in your project. You can find the default template of it below: https://github.com/abpframework/abp/blob/b920220c672d8d1fbbbae850965bb117d8a71da1/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/abp.resourcemapping.js

    module.exports = {
        aliases: {
    
        },
        clean: [
    
        ],
        mappings: {
    
        }
    };
    

    After updating package.json and abp.resourcemapping.js files, abp install-lib command will work properly and copy your dependencies under wwwroot.

    abp install-libs
    
  • User Avatar
    0
    balessi75 created

    Hi @balessi75

    You can create abp.resourcemapping.js manually in your project. You can find the default template of it below: https://github.com/abpframework/abp/blob/b920220c672d8d1fbbbae850965bb117d8a71da1/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/abp.resourcemapping.js

    module.exports = { 
        aliases: { 
     
        }, 
        clean: [ 
     
        ], 
        mappings: { 
     
        } 
    }; 
    

    After updating package.json and abp.resourcemapping.js files, abp install-lib command will work properly and copy your dependencies under wwwroot.

    abp install-libs 
    

    Hi @enisn,

    We manually created a abp.resourcemapping.js file in the root of our Blazor project, but we are getting compile time errors:

    Any ideas? Does the js file need to be in a certain location for a Blazor Server project?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Make sure it's not marked as content or something else in your .csproj file.

    There shouldn't be any Build action for that file.

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