We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a section on this until the PU addresses it on dotnet/aspnetcore#49147.
The code will be something like (either of the following from devs in discussion on the PU issues will work) ...
public class DisplayNamePropertyColumn<TGridItem, TProp> : PropertyColumn<TGridItem, TProp> { protected override void OnParametersSet() { if (Title is null && Property.Body is MemberExpression memberExpression) { var memberInfo = memberExpression.Member; var displayName = memberInfo?.GetCustomAttribute(typeof(DisplayNameAttribute)) as DisplayNameAttribute; var display = memberInfo?.GetCustomAttribute(typeof(DisplayAttribute)) as DisplayAttribute; Title = displayName?.DisplayName ?? display?.Name ?? memberInfo?.Name ?? ""; } base.OnParametersSet(); } }
... or ...
public class DisplayNamePropertyColumn<TGridItem, TProp> : PropertyColumn<TGridItem, TProp> { protected override void OnParametersSet() { if (Title is null && Property.Body is MemberExpression memberExpression) { var memberInfo = memberExpression.Member; Title = memberInfo?.GetCustomAttributes<DisplayNameAttribute>(false).FirstOrDefault()?.DisplayName ?? memberInfo?.GetCustomAttributes<DisplayAttribute>(false).FirstOrDefault()?.Name ?? memberInfo?.GetCustomAttributes<DisplayNameAttribute>(true).FirstOrDefault()?.DisplayName ?? memberInfo?.GetCustomAttributes<DisplayAttribute>(true).FirstOrDefault()?.Name ?? memberInfo?.Name; } base.OnParametersSet(); } }
... with the model DA as ...
[Display(Name = "Release Date")] public DateTime ReleaseDate { get; set; }
... and the subclassed column in the QG ...
<DisplayNamePropertyColumn Property="movie => movie.ReleaseDate" />
https://learn.microsoft.com/en-us/aspnet/core/blazor/components/quickgrid?view=aspnetcore-8.0
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/quickgrid.md
564e71e3-82ed-ce23-4f9f-a00a58734a62
@guardrex
The text was updated successfully, but these errors were encountered:
We'll be going with ... 🥁🥁🥁 PLZ ...
if (Title is null && Property.Body is MemberExpression memberExpression) { var memberInfo = memberExpression.Member; Title = memberInfo.GetCustomAttribute<DisplayNameAttribute>().DisplayName ?? memberInfo.GetCustomAttribute<DisplayAttribute>().Name ?? memberInfo.Name; } base.OnParametersSet();
Sorry, something went wrong.
guardrex
Successfully merging a pull request may close this issue.
Description
Add a section on this until the PU addresses it on dotnet/aspnetcore#49147.
The code will be something like (either of the following from devs in discussion on the PU issues will work) ...
... or ...
... with the model DA as ...
... and the subclassed column in the QG ...
Page URL
https://learn.microsoft.com/en-us/aspnet/core/blazor/components/quickgrid?view=aspnetcore-8.0
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/components/quickgrid.md
Document ID
564e71e3-82ed-ce23-4f9f-a00a58734a62
Article author
@guardrex
The text was updated successfully, but these errors were encountered: