Tooltip custom validation messages in Datagrid Template edit

Hello,

I want to use a custom validator to display tooltip errors in an edit dialog that is built from a template. I tried to follow your example where you build MyCustomValidator.cs ( https://blazor.syncfusion.com/documentation/datagrid/column-validation )

But the problem is that it expects a cascading parameter of EditForm and I am not using an edit form. My layout is like this:

<DataGrid>

    <Validator>

        <CustomValidator>

    </Validator>

    <Template>

    </Template>

</DataGrid>


Is there a way to use Tooltip error display in a dialog built using a template that isn't an EditForm?



7 Replies

KG Keerthana Ganesan Syncfusion Team September 5, 2022 03:29 PM UTC

Hi Sheldon,

Greetings from Syncfusion support.

We have analyzed your query and we suggest you use the in-built validation tooltip to show those error messages by using Validator TemplateContext.ShowValidationMessage(fieldname, IsValid, Message)
method. We have already discussed this topic in our UG documentation. Kindly refer to the attached document link for your reference.

Reference link:
https://blazor.syncfusion.com/documentation/datagrid/column-validation#display-validation-message-using-in-built-tooltip

Kindly get back to us if you have any further queries.


Regards,

Keerthana.



SH Sheldon September 5, 2022 03:38 PM UTC

This is exactly the example I was following but it doesn't seem to work. The difference in my case is that I am using a Template in order to be able to edit fields that don't show in the grid. Take your example and use a Template instead and I think you will see the issue.


Thanks




KG Keerthana Ganesan Syncfusion Team September 6, 2022 03:56 PM UTC

Hi Sheldon,

Welcome from Syncfusion support.

We have analyzed your query and we would like to inform you that the data grid is a templated blazor component that allows you to customize various parts of UI using template parameters. It allows you to render the custom components or content based on your own logic. Whereas validation cannot be performed in Template. Kindly refer to the attached documentation for your reference.

Reference link: https://blazor.syncfusion.com/documentation/datagrid/templates

Kindly get back to us if you have any further queries.

Regards,

Keerthana.



SH Sheldon September 6, 2022 03:59 PM UTC

Ah ok, so you are saying it's just not possible inside of a Template? Any alternative suggestions? I need to use <Template> because I am editing fields that are not in the grid.



KG Keerthana Ganesan Syncfusion Team September 7, 2022 04:31 PM UTC

Hi Sheldon,

Welcome from Syncfusion support.

We have analyzed your query, and we suggest you use the form validation to display the validation message in the dialog template. We have discussed this similar topic in our UG documentation. Kindly refer to the attached documentation for your reference.

Reference link: https://blazor.syncfusion.com/documentation/datagrid/column-validation#display-validation-message-in-dialog-template

Kindly get back to us if you have any further queries.


Regards,
Keerthana.



SH Sheldon September 7, 2022 04:33 PM UTC

This is what I am doing but i would like to show tooltips not errors piled at the top of the dialog.



SP Sarveswaran Palani Syncfusion Team September 9, 2022 07:27 PM UTC

Hi Sheldon,


Sorry for the delay and inconvenience caused.


We have analyzed your query and try to show tooltip validation within a dialog template. But it’s not possible to do within dialog template. We suggest you to do custom validation in default dialog editing or display validation message at top op the dialog. Kindly refer the attached sample and image for your reference.



Kindly get back to us if you have any further queries.


Regards,

Sarveswaran PK


Attachment: SfGridDialogValidation_c4a12fb3.zip

Loader.
Up arrow icon