Is it possible to trigger grid validations by code?

I read in the docs that it is possible to pass a validator to the GridEditSettings, I tested it and it is working fine, however I would like to trigger the validations once the DataSource of the grid has changed, I tried using the Refresh method, but after the DataSource has changed and I added invalid records, the Refresh method doesn't trigger the validations, so I was wondering if there is a way to show the validations in the rows after a Data Source changes?




Please any help on this will be very useful




Daniel




3 Replies

RS Renjith Singh Rajendran Syncfusion Team September 3, 2021 05:05 AM UTC

Hi Daniel, 

Greetings from Syncfusion support. 

We would like to inform you that, Grid validations will be applied only for the Grid edit form validations. Please refer the below documentations and demos for more details on different ways of applying grid validation to Grid’s editform. You can use any one of the below available validations for your Grid. Validations will be applied on grid editing action only. 
References :  
 
Based on your scenario, we could see that you would like to trigger a method when changing Grid’s entire DataSource. At these case of changing Grid’s entire data the DataBound and RowDataBound events of Grid will be triggered. You can get each row data values in the RowDataBoundEventArgs argument of RowDataBound event. You can access the each grid’s row data in this event handler and perform your action inside this event. 
References :  

If we have misunderstood your query or requirement kindly share with us a detailed explanation of the requirement or problem you are facing and also share a video demo explaining your requirement. 

Regards, 
Renjith R 



DO Daniel Orellana replied to Renjith Singh Rajendran September 3, 2021 06:06 PM UTC

Thanks for answering Renjith,

In order to confirm this, if I use the DataBound or RowDataBound events I will be able to know when a record has been added and retrieve the information or the row, but I won't be able to show the validation inside the row like I was thinking previously, instead I could show something else like a dialog in order to show my validations, is that correct?


Daniel



RS Renjith Singh Rajendran Syncfusion Team September 6, 2021 12:17 PM UTC

Hi Daniel, 

As informed in our previous update, you can display validation tooltip based on validation results in Grid’s edit form only. Based on your scenario, you can check for the rows in Grid using the suggested events(DataBound and RowDataBound) and display a dialog based on your result. 

Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon