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

Validation

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.

2 Replies

ST stanleyj 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


SA Salim Amin Padela December 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.

Loader.
Live Chat Icon For mobile
Up arrow icon