Ends in:
2 DAYS
10 HRS
33 MIN
22 SEC
Ends in:
2 D
10 H
33 M
22 S
Open Closed

We would like to Override abp-input tag helpers #1260


User avatar
0
viswajwalith created
  • ABP Framework version: v4.3
  • UI type: MVC
  • DB provider: EF Core / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): yes (Micro Service one)
  • Exception message and stack trace:
  • Steps to reproduce the issue:

We would like to over ride the abp-input controls to customize the UI, can you please guide on how to perform the same. I mean Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.

I know we can override the pages but just trying to find a way to overRride Abp Tag helper so that it can be updated everywhere with very minila code.


7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can try to create a new taghelper and make it executed first.

    https://github.com/abpframework/abp/blob/48c52625f4c4df007f04d5ac6368b07411aa7521/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpIdNameTagHelper.cs#L18

  • User Avatar
    0
    viswajwalith created

    hi

    You can try to create a new taghelper and make it executed first.

    https://github.com/abpframework/abp/blob/48c52625f4c4df007f04d5ac6368b07411aa7521/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpIdNameTagHelper.cs#L18

    Yes, creating a new one is one of the option, but Lets suppose we had to customize the textbox across application, we need to include the files of administration and SAAS modules and override those. Inisted of that if we can override adp-input tag helper it would be easy approch right.

    Is there any way to include .cshtml of respective tag helper to override the defayult ones?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Maybe you can try:

    using System.Text.Encodings.Web;
    using Microsoft.AspNetCore.Mvc.ViewFeatures;
    using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers;
    using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;
    using Volo.Abp.DependencyInjection;
    
    namespace MyCompanyName.MyProjectName.Web
    {
        [Dependency(ReplaceServices = true)]
        [ExposeServices(typeof(AbpInputTagHelperService))]
        public class MyInputTagHelperService : AbpInputTagHelperService
        {
            public MyInputTagHelperService(IHtmlGenerator generator,
                HtmlEncoder encoder,
                IAbpTagHelperLocalizer tagHelperLocalizer)
                : base(generator, encoder, tagHelperLocalizer)
            {
            }
    
        }
    
        [Dependency(ReplaceServices = true)]
        [ExposeServices(typeof(AbpInputTagHelper))]
        public class MyInputTagHelper : AbpInputTagHelper
        {
            public MyInputTagHelper(AbpInputTagHelperService tagHelperService)
                : base(tagHelperService)
            {
    
            }
        }
    }
    
    
  • User Avatar
    0
    viswajwalith created

    Maybe you can try:

    using System.Text.Encodings.Web; 
    using Microsoft.AspNetCore.Mvc.ViewFeatures; 
    using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers; 
    using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; 
    using Volo.Abp.DependencyInjection; 
     
    namespace MyCompanyName.MyProjectName.Web 
    { 
        [Dependency(ReplaceServices = true)] 
        [ExposeServices(typeof(AbpInputTagHelperService))] 
        public class MyInputTagHelperService : AbpInputTagHelperService 
        { 
            public MyInputTagHelperService(IHtmlGenerator generator, 
                HtmlEncoder encoder, 
                IAbpTagHelperLocalizer tagHelperLocalizer) 
                : base(generator, encoder, tagHelperLocalizer) 
            { 
            } 
     
        } 
     
        [Dependency(ReplaceServices = true)] 
        [ExposeServices(typeof(AbpInputTagHelper))] 
        public class MyInputTagHelper : AbpInputTagHelper 
        { 
            public MyInputTagHelper(AbpInputTagHelperService tagHelperService) 
                : base(tagHelperService) 
            { 
     
            } 
        } 
    } 
     
    

    I am not sure, in this case where we can overide the html content of Tag helpers? Are we missing anything here?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can overiide some base class methods of AbpInputTagHelperService in your MyInputTagHelperService .

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs

  • User Avatar
    0
    viswajwalith created

    You can overiide some base class methods of AbpInputTagHelperService in your MyInputTagHelperService .

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs

    Sure, We will give a try and update you back. Thanks

  • User Avatar
    0
    viswajwalith created

    You can overiide some base class methods of AbpInputTagHelperService in your MyInputTagHelperService .

    https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs

    It Worked perfectly. Now we are able to over ride the input helper. Thanks for the info @maliming.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35