Is there a way to show the OnFailureAction error message as a tooltip in the edit dialog

Hi,

I have a grid with EditMode set to Dialog.  When changes are being saved in the dialog, the save action may generate an exception.  I can see that I can catch this in the OnFailureAction method, but is there then a way that I can show this error as a tooltip in the dialog?

For example, I have a grid as follows.

<SfGrid TValue="WasteType" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Search" })" AllowSorting="true" AllowResizing ="true">

<SfDataManager AdaptorInstance="@typeof(CustomAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>
    <GridEvents OnActionFailure="ActionFailureHandler" TValue="WasteType"></GridEvents>
    <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" ShowDeleteConfirmDialog="true"
    Mode="Syncfusion.Blazor.Grids.EditMode.Dialog">
    </GridEditSettings>
    <GridColumns>
     <GridColumn Field=@nameof(WasteType.Code) HeaderText="Code" Width="10%" IsPrimaryKey="true" ValidationRules="@(new ValidationRules{ Required=true})" TextAlign="TextAlign.Left"></GridColumn>
        <GridColumn Field=@nameof(WasteType.Description) HeaderText="Description" Width="30%" ValidationRules="@(new ValidationRules{ Required=true})" TextAlign="TextAlign.Left"></GridColumn>
        <GridColumn Field=@nameof(WasteType.PhysicalForm) HeaderText="Physical Form" TextAlign="TextAlign.Left"></GridColumn>
</GridColumns>
</SfGrid>


@code {
    public async Task ActionFailureHandler(Syncfusion.Blazor.Grids.FailureEventArgs args)
    {
        if (args.Error != null)
        {
            //show error as tooltip
        }
    }
}

Is there some way to use something like the context.ShowValidationMessage function from the ActionFailureHandler code? 


3 Replies 1 reply marked as answer

PS Prathap Senthil Syncfusion Team July 16, 2025 01:52 PM UTC

Hi Jeremi Reda,


Based on your requirement, we regret to inform you that it is not possible to display the action failure error within the built-in validation tooltip. However, we suggest displaying the error by rendering an SfDialog to show the error message when an action fails. Kindly refer to the code snippet and sample below for your reference.

<SfGrid TValue="Order" Toolbar="@(new List<string>{"Add","Edit","Update","Delete"})" Height="300">

    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog" ></GridEditSettings>

  

     

    <GridEvents OnActionFailure="ActionFailureHandler"  TValue="Order"></GridEvents>

  

    

</SfGrid>

 

 

 

   

<SfDialog Width="250px" IsModal

="true" Visible="@IsVisible" ShowCloseIcon="true">

    <DialogTemplates>

        <Content> @ErrorMessage </Content>

    </DialogTemplates>

</SfDialog>


private string ErrorMessage;

 

public bool IsVisible { get; set; } = false;   

 

public async Task ActionFailureHandler(Syncfusion.Blazor.Grids.FailureEventArgs args)

{

     if (args?.Error?.Message != null)

     {

         ErrorMessage = args.Error.Message;

         IsVisible= true;   

     }

}



Sample: https://blazorplayground.syncfusion.com/embed/htreNQCdJtMfVHTI?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

Reference: Getting Started with Syncfusion Blazor Dialog Component in Web App

Regards,
Prathap S


Marked as answer

JR Jeremi Reda replied to Prathap Senthil July 17, 2025 11:46 AM UTC

Thanks for this.  Nice to know that I was on the right track as I was using the Predefined Dialog component.



PS Prathap Senthil Syncfusion Team July 18, 2025 10:46 AM UTC

Thank you for the update. We're happy to hear that the information provided was helpful. Please feel free to reach out to us if you have any further queries.


Loader.
Up arrow icon