Fluent Validation inside Blazor Grid Edit Modal

Hi. i'm creating a application using the blazor components, this app has 2 main ways of creating records, one is trough a EditForm (blazor) and the other simpler method is using directly the SFGrid, inside the EditForm i'm using the FluentValidator Component.

Example Bellow:

      <EditForm @attributes="atributes" Model="@Item.Entity" OnValidSubmit="@OnValidSubmitAsync" OnInvalidSubmit="@OnInvalidSubmitAsync">
            @if (Validator != null)
            {
                <FluentValidator Validator="@Validator" />
                <ValidationSummary />
            }
            @LayoutFragment(Item.Entity)
        </EditForm>

But with the grid, i'm using the standard modal with a custom ActionBegin

<SfGrid ID="Grid" @ref="@Grid" TValue="TEntity" DataSource="@DataSource" AllowFiltering="true" AllowPaging="true" Toolbar="@ToolbarOptions" AllowExcelExport="true" AllowPdfExport="true" Height="315">
    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" ShowDeleteConfirmDialog="true" Mode="EditMode.Dialog" Dialog="DialogParams">
        <HeaderTemplate>
            @{
                var text = ModalHeaderText((context as TEntity));
                <span>@text</span>
            }
        </HeaderTemplate>
    </GridEditSettings>
    <GridPageSettings PageSize="5"></GridPageSettings>
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings>
    <GridSelectionSettings Mode="SelectionMode.Row" Type="Syncfusion.Blazor.Grids.SelectionType.Single"></GridSelectionSettings>
    <GridEvents OnActionBegin="ActionBegin" OnToolbarClick="ToolbarClick" TValue="TEntity"></GridEvents>
    <GridColumns>
        @SimpleGridColumns
    </GridColumns>
</SfGrid>

My question boils down to "How can i use the fluent validation i already have inside the modal of the Grid?"

1 Reply 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team October 9, 2020 04:21 PM UTC

Hi MARCELO, 

Greetings from Syncfusion. 

We have validated your query and might suspect that you want to know how to use Fluent validation in Grid model class. Here, we have prepared a sample based on this requirement. Find the below sample for your reference. 


If it does not meet your requirement or if we misunderstood your query, then could you please share more information regarding your requirement. It will be helpful to validate and provide a better solution. 

Regards, 
Rahul  


Marked as answer
Loader.
Up arrow icon