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

Cancel edit on GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

41375 Feb 28,2006 08:39 PM UTC Mar 1,2006 04:12 PM UTC Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 28, 2006 08:39 PM UTC

I am trying to disable editing on a cell using some logic based on the data in the row. I intercept the TableControlCurrentCellStartEditing event and if my condition says you can''t edit I set e.Inner.Cancel = true; However this doesn''t seem to prevent the editing of non text cells. Basically checkboxes and dropdowns allow you to continue and modify the values. I then tried to catch the RecordValueChanging event and cancel the changes there but I am not entirely sure in a nestedtable how I would get back to the original record to test my condition. Is there a reason is doesn''t work with non text fields?

Administrator [Syncfusion]
Replied On March 1, 2006 02:27 PM UTC

Hi Chuck, The CurrentCellStartEditing event will be triggered before the current cell switches into editing mode. But in the case of Check celltype there is no editing mode which causes the event not to work with non text fields. In order to cancel the checkbox and comboBox value, the RecordValueChanging event is a better choice. And the Nested table records can be canceled by checking the e.Record is a Parent table or child table record. Here is the code snippet private void gridGroupingControl1_RecordValueChanging(object sender, Syncfusion.Grouping.RecordValueChangingEventArgs e) { if(e.Record == this.gridGroupingControl1.Table.CurrentRecord) // Checking e.Record is parent record { if(Convert.ToInt32(e.Record.GetValue("Integer")) < 10) e.Cancel = true; } else if(e.Record == this.gridGroupingControl1.Table.RelatedTables["ParentToChild"].CurrentRecord) // Checking e.Record is child record { if(Convert.ToInt32(e.Record.GetValue("Integer1")) < 5) e.Cancel = true; } } Here is the Demo project Best Regards, Madhan.

Administrator [Syncfusion]
Replied On March 1, 2006 03:00 PM UTC

Well you never addressed the problem I had with using the RecordValueChanging event. I don''t know how to retrieve values from the parent record when it is a nested value. I didn''t say that I couldn''t identify whether or not it was a nested entry. So for any dropdown (nested or otherwise) I need to validate against the parent rows data. So how do I get the parent row from the nested recrd.

Administrator [Syncfusion]
Replied On March 1, 2006 04:12 PM UTC

Hi Chuck, you can get access to the parent record from any nested record as follows: Record nestedRecord; // the nested record (could also be some other element, e.g. RecordRow, a group caption or ... // Example: use current record as nested record. nestedRecord = e.TableControl.Table.CurrentRecord; // Get the parent child table: ChildTable ct = nestedRecord.ParentChildTable; // Get the nested table that references this child table from the parent record NestedTable nt = ct.ParentNestedTable; // Get the Record that owns this nested table Record parentRecord = nt.ParentRecord; // Now you can get values from the parent record object value = parentRecord.GetValue(field); Stefan >Well you never addressed the problem I had with using the RecordValueChanging event. I don''t know how to retrieve values from the parent record when it is a nested value. I didn''t say that I couldn''t identify whether or not it was a nested entry. > >So for any dropdown (nested or otherwise) I need to validate against the parent rows data. So how do I get the parent row from the nested recrd.

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

;