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.
- Share your Grid rendering code example.
- Are you facing any script error while editing a record? . If yes, share the screenshot of the issue.
- Share your Syncfusion Nuget package version details.
- 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.