)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to enable or disable the editing a record based on the value of a unbound column in WinForms GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: July 26, 2016 |
Last Revised Date: December 24, 2019

Enable or disable the editing record

In GridGroupingControl, you can enable or disable the editing a record based on the value of unbound column by subscribing the TableControlCurrentCellStartEditing event and setting the Inner.Cancel property of event argument.

For example, in the below code snippet, Records can be retrieved through the GetRecord() method and disable the editing based on the unbound column’s value by setting the Cancel property as true.

C#

//For handling the editing of the cells
this.gridGroupingControl1.TableControlCurrentCellStartEditing += gridGroupingControl1_TableControlCurrentCellStartEditing;
 
void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
{
  GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);
  if (style.TableCellIdentity.Column.Name != "UnboundColumnName")
  {
    Record record =style.TableCellIdentity.DisplayElement.GetRecord();
    if (record.GetValue("UnboundColumnName ").ToString() != "0")
    {
      //Cancel the editing for the record values
      e.Inner.Cancel = true;
    }
  }
}

 

VB

'For handling the editing of the cells
AddHandler Me.gridGroupingControl1.TableControlCurrentCellStartEditing, AddressOf gridGroupingControl1_TableControlCurrentCellStartEditing
 
void gridGroupingControl1_TableControlCurrentCellStartEditing(Object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
  Dim style As GridTableCellStyleInfo = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex)
  If style.TableCellIdentity.Column.Name <> " UnboundColumnName" Then
    Dim record As Record =style.TableCellIdentity.DisplayElement.GetRecord()
    If record.GetValue("UnboundColumnName").ToString() <> "0" Then
      'Cancel the editing for the record values
      e.Inner.Cancel = True
    End If
  End If

 

Enable the editing a record based on the value of a unbound column :Enable the editing a record based on unbound column valueDisable the editing a record based on the value of a unbound column :Disable the editing a record based on unbound column value

Samples:

C#: RadioButton_UnBoundColumn_CS

VB: RadioButton_UnBoundColumn_VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon