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.
Syncfusion Feedback

How to verify childTable value of the new record added in parentTable

Thread ID:

Created:

Updated:

Platform:

Replies:

71977 Feb 25,2008 08:02 AM UTC Mar 28,2008 09:53 PM UTC Windows Forms 1
loading
Tags: GridControl
Harry
Asked On February 25, 2008 08:02 AM UTC

Hello,

I have tables of master-detail type relationship: ParentTable is "Currency", ChildTable is "Rate".

if user put a new record in "Currency" how to verify if this user had been entered at least one record for "Rate" of this new "Currency" name?
Before the user click "Save" button, we expect that it reject to save the "Currency" table if there is no rate value entered in "Rate" table. We expect no new Currency name being saved without any rate value set in childtable.
How to perfecly code it for btnSave_click event?

Thanks for your assist!
Harry


Administrator [Syncfusion]
Replied On March 28, 2008 09:53 PM UTC

Hi Harry,

Thanks for using Syncfusion products.

You can validate the data before insert into the grid by using "CurrentRecordContextChange" event. Please refer the below given code snippet:


private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if (e.Action == CurrentRecordAction.EndEditCalled && e.Record.Kind == DisplayElementKind.AddNewRecord)
{
Record rec = e.Record.GetRecord();
//You can validate this data.
if (((e.Record.GetRecord().GetValue("Rate") == null) || (e.Record.GetRecord().GetValue("Rate").ToString().Length == 0)))
{
MessageBox.Show("Invalid data");
e.Cancel = true;
}
}
}


Please let me know if you have any questions.

Best regards,
Haneef


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.

Warning Icon 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.Close Icon

;