Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Telerik blazor grid doesn't stay in edit mode when there are validation errors

$
0
0

I am using telerik blazor grid with inline cell editing. I want the grid to stay in edit mode when there are validation errors. When I hit on Save it just comes out of edit mode. Below is the code that I am using:

<EditForm EditContext="@gridEditContext"><DataAnnotationsValidator></DataAnnotationsValidator><TelerikGrid Data="@gridData"        Pageable="true"        Sortable="true"        Width="2500px"        PageSize="50"        FilterMode="GridFilterMode.FilterMenu"        EditMode="GridEditMode.Inline"><GridSettings><GridValidationSettings Enabled="true" /></GridSettings><GridColumns><GridColumn Field="@nameof(Dto.CustNumber)" Title="Customer No." Width="100px"  Filterable="true" Sortable="false" /><GridColumn Field="@nameof(Dto.DistributorLastName)" Title="Last Name" Width="200px" Filterable="true" /><GridColumn Field="@nameof(Dto.DistributorNumber)" Title="Distributor No." Width="120px" Filterable="false" Sortable="false" /><GridCommandColumn Width="100px"><ChildContent Context="gridCommandContext"><GridCommandButton Command="Edit" OnClick="@OnGridDataEdit">Edit</GridCommandButton><GridCommandButton Command="Save" ShowInEdit="true" OnClick="@OnGridDataSave">Save</GridCommandButton><GridCommandButton Command="Cancel" ShowInEdit="true">Cancel</GridCommandButton></ChildContent></GridCommandColumn></GridColumns></TelerikGrid></EditForm>private async Task OnGridDataSave(GridCommandEventArgs args){    var updatedDto = (Dto)args.Item;    gridEditContext.EnableDataAnnotationsValidation();    if (!gridEditContext.Validate())    {         args.IsCancelled = true;    }  }

Viewing all articles
Browse latest Browse all 4839

Trending Articles