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

editable grid grouping control

I am using syncfusion grid grouping control.
In my application some columns are editable and some are not editable...the following code that i am using dissables cursor from all the cell. kindly help me so that cursor is dissabled for only selected cells..

void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
Syncfusion.Grouping.Element el = e.TableCellIdentity.DisplayElement;
if (el.Kind == Syncfusion.Grouping.DisplayElementKind.Record && e.TableCellIdentity.Column != null &&
(e.TableCellIdentity.Column.Name == "Type" || e.TableCellIdentity.Column.Name == "Enabled"))
{
e.Style.ReadOnly = false;
e.Style.BackColor = Color.AliceBlue;
}
else
{
e.Style.ReadOnly = true;
}

}

void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
{
e.Inner.Cancel = true;
}

1 Reply

JS Jeba S Syncfusion Team September 12, 2007 07:51 AM UTC

Hi prabhjeet,

Thank you for posting query to us.

Prevent the edit mode

You can prevent the edit mode in three ways.

Option 1:Using Static CellType

this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.CellType = "Static";


Option 2:Using Enabled Property

this.gridGroupingControl1.TableDescriptor.Columns[1].Appearance.AnyRecordFieldCell.Enabled = false;


Option 3:By handling CurrentRecordContextChange


void Table_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
//Option 3
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
GridTableCellStyleInfo style = table.GetTableCellStyle(cc.RowIndex, cc.ColIndex);
if (e.Action == Syncfusion.Grouping.CurrentRecordAction.BeginEditCalled)
{
if (style.TableCellIdentity.Column.Name == "NonEditable Column")
{
e.Cancel = true;
}
}
}


Please refer the sample and let us know if this helps.
http://websamples.syncfusion.com/samples/Grid.Windows/F68212/main.htm

Thank you for using Syncfusion Products.

Best Regards,
Jeba.

Loader.
Live Chat Icon For mobile
Up arrow icon