diff --git a/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs b/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs index 45280b81..3353d7d6 100644 --- a/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs +++ b/src/admin/Bootstrap.Admin/Pages/Components/LgbTableHeader.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Components; +using BootstrapBlazor.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Microsoft.Extensions.DependencyInjection; using System; @@ -64,14 +65,18 @@ namespace Bootstrap.Admin.Pages.Components public string GetDisplayName() { var ret = ""; - if (_fieldIdentifier == null) _fieldIdentifier = FieldIdentifier.Create(ValueExpression); + if (_fieldIdentifier == null) + { + _fieldIdentifier = FieldIdentifier.Create(ValueExpression); + } + if (DisplayNamesExtensions.TryGetValue((_fieldIdentifier.Value.Model.GetType(), _fieldIdentifier.Value.FieldName), out var s)) { ret = s; } if (string.IsNullOrEmpty(ret)) { - ret = _fieldIdentifier?.GetDisplayName() ?? ""; + ret = _fieldIdentifier.HasValue ? FieldIdentifierExtensions.GetDisplayName(_fieldIdentifier.Value) : ""; } return ret; } @@ -81,7 +86,11 @@ namespace Bootstrap.Admin.Pages.Components /// public string GetFieldName() { - if (_fieldIdentifier == null) _fieldIdentifier = FieldIdentifier.Create(ValueExpression); + if (_fieldIdentifier == null) + { + _fieldIdentifier = FieldIdentifier.Create(ValueExpression); + } + return _fieldIdentifier?.FieldName ?? ""; } } diff --git a/src/admin/Bootstrap.Admin/Pages/Components/ValidateInputBase.cs b/src/admin/Bootstrap.Admin/Pages/Components/ValidateInputBase.cs index 17371724..9f9235d2 100644 --- a/src/admin/Bootstrap.Admin/Pages/Components/ValidateInputBase.cs +++ b/src/admin/Bootstrap.Admin/Pages/Components/ValidateInputBase.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Components; +using BootstrapBlazor.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Microsoft.JSInterop; using System; diff --git a/src/admin/Bootstrap.Admin/Startup.cs b/src/admin/Bootstrap.Admin/Startup.cs index 4ab22d88..491b7522 100644 --- a/src/admin/Bootstrap.Admin/Startup.cs +++ b/src/admin/Bootstrap.Admin/Startup.cs @@ -92,6 +92,7 @@ namespace Bootstrap.Admin if (Enviroment.IsDevelopment()) options.DetailedErrors = true; }); services.AddDisplayNames(); + services.AddBootstrapBlazor(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.