AutoQueryGrid - customise model display name?

Hi

Is there a way to customise the AutoQueryGrid CRUD display name for the model? My model is called TriageOption - and in the New button and autoform, I would like it to display as Triage Option.

SS seems to separate the field names automatically, but not the model name itself.

Thanks in advance!

Are you referring to the Auto Forms used by the AutoQueryGrid?

If so have a look at the [Description] and [Notes] API Annotation attributes on the AutoForm component:

[Description("Update an existing Booking")]
[Notes("Find out how to quickly create a <a class='svg-external' target='_blank' href='https://youtu.be/rSFiikDjGos'>C# Bookings App from Scratch</a>")]
[Route("/booking/{Id}", "PATCH")]
[ValidateHasRole("Employee")]
[AutoApply(Behavior.AuditModify)]
public class UpdateBooking : IPatchDb<Booking>, IReturn<IdResponse>
{
    public int Id { get; set; }
    public string? Name { get; set; }
    public RoomType? RoomType { get; set; }
    [ValidateGreaterThan(0)]
    public int? RoomNumber { get; set; }
    [ValidateGreaterThan(0)]
    public decimal? Cost { get; set; }
    public DateTime? BookingStartDate { get; set; }
    public DateTime? BookingEndDate { get; set; }
    [Input(Type = "textarea")]
    public string? Notes { get; set; }
    public bool? Cancelled { get; set; }
}

We didn’t have a way to customize the New Button Label before, but I’ve just added the NewButtonLabel to AutoQueryGrid component, e.g:

<AutoQueryGrid NewButtonLabel="New Item" ... />

You’re also able to configure a default Title for your Models used in Blazor Components with:

TextUtils.FormatHumanizeType = type => TextUtils.SplitCase(type.Name).ToTitleCase();

This change is available from v8.2.3+ that’s now available in the Pre Release packages.

Perfect, thank you! That works brilliantly, especially the ability to set it globally.

Thanks for the quick response!

1 Like