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.
Unfortunately, activation email could not send to your email. Please try again.

Validation

Thread ID:

Created:

Updated:

Platform:

Replies:

38392 Dec 12,2005 05:00 AM Dec 13,2005 03:14 AM Windows Forms 2
loading
Tags: Grouping
Salim Amin Padela
Asked On December 12, 2005 05:00 AM

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.

stanleyj [Syncfusion]
Replied On December 12, 2005 10:49 AM

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

Salim Amin Padela
Replied On December 13, 2005 03:14 AM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;