The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi.
Is there any way to add custom validation to each cell?
I have one grid which has 5 columns. I want that user should enter data in atleast 4 columns. If the user enters data in 3 columns and leaves the Row, that row should not be added rather he should be prompted the confirmation to either cancel the newrow or continue editing row.
Please Help.
STstanleyj Syncfusion Team December 12, 2005 03:49 PM UTC
Hi James,
This could be tried in CurrentRecordContextChange handler. You can do whatever tests you want on e.Record. If they fail, then set e.Cancel = true. Below is a snippet that does not let you leave the record unless the value in Col1 is bigger than 20.
private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if(e.Action == CurrentRecordAction.EndEditCalled)
{
Record rec = e.Record as Record;
if(rec != null)
{
object o = rec.GetValue("Col1");
if(o == null || ((int) o) < 20)
{
e.Cancel = true;
}
}
}
}
Best regards,
Stanley
SASalim Amin PadelaDecember 13, 2005 08:14 AM UTC
Fine.
What i was expecting is something like ValidationControls just like we have in ASP.Net. Like i can mention the type of validation in the Property of Column and it should validate it automatically for every cell in that column.