We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Grid custom validation rules for Blazor

Hello, Syncfusion

I try to use validation rules with variable to validate minimum value in Grid column like this,

<GridColumn Field=@nameof(JobTask.Cost) HeaderText="Cost" TextAlign="TextAlign.Center" Format="N2" Width="10%" ValidationRules="@(new { required = true, min =  ValidateValue })"></GridColumn>

but it's not work, what should I do?

Thanks,
Puriphat S.

3 Replies

VN Vignesh Natarajan Syncfusion Team December 9, 2019 09:08 AM UTC

Hi Puriphat,  

Greetings from Syncfusion support.  

Query: “I try to use validation rules with variable to validate minimum value in Grid column like this, but it's not work, what should I do? 
 
We tried to replicate the reported issue by preparing a sample with Edit operation to validate the number column with minimum value. We have defined the ValidationRules property to GridColumn like below and we are not able to reproduce the reported issue at our end. While editing / adding , validation rules is displayed when saving with value less than 95.  

<EjsGrid DataSource="@Orders" Height="315" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })"> 
. . . . . . . . . .  
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Cost" TextAlign="TextAlign.Center" Format="N2" Width="10%" ValidationRules="@(new { required = true, min =  ValidateValue })"></GridColumn> 
    </GridColumns> 
</EjsGrid> 
 
@code{ 
    public List<Order> Orders { get; set; } 
    public int ValidateValue = 95; 
. . . . . . . ..   
} 

Refer the below screenshot for the output  

 

Kindly download the sample from below  


If you are still facing the issue, kindly get back to us with following details.  

  1. Share your Grid rendering code example.
  2. Are you facing any script error while editing a record? . If yes, share the screenshot of the issue.
  3. Share your Syncfusion Nuget package version details.
  4. If possible try to reproduce the reported issue in provided sample.

Requested details will be helpful for us to validate the reported issue at our end and provide solution as soon as possible. 

Regards, 
Vignesh Natarajan. 



PS Puriphat Sinanalert December 11, 2019 09:38 AM UTC

Thank you for your answer!

But to be more clear, I need to compare and validate between cost and actual cost column by the cost must be greater than actual cost and validate while editing.

Here's the screenshot of example.

https://ibb.co/pwFJjr4


Thanks,

Puriphat Sinananlert.



VN Vignesh Natarajan Syncfusion Team December 12, 2019 11:05 AM UTC

Hi Puriphat, 

Query: “ need to compare and validate between cost and actual cost column by the cost must be greater than actual cost and validate while editing. 

We can achieve your requirement using Custom validation feature. But currently we do not have support for custom validation for Blazor Grid. We have logged this as a feature task and added to our feature request list. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.  
 
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We have considered this requirement for our 2019 Volume 4 Service pack 1 release which is expected to rolled out in the month of January 2020.  
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.   
 

Till then we appreciate your patience.  

Regards, 
Vignesh Natarajan. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon