non editable grid grouping control

I am using syncfusion grid grouping control.
The following code make the cell non editable of grid grouping control...but the focus of cursor is still there...no doubt that i cannot edit the cell but i don't want that cursor should be there..


following code make cell non editable but does not remove cursor focus from the cell..

private void ggcMapDetails_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
Element el = e.TableCellIdentity.DisplayElement;
if (el.Kind == 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;
}

}



5 Replies

J. J.Nagarajan Syncfusion Team September 11, 2007 06:24 PM UTC

Hi Prabhjeet,

Thanks for your continued interest in SYncfusion product. To avoid the cursor inside the cell you have to handle TableControlCurrentCellStartEditing event . Please refer to the following code snippet

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;
}


I have attached the sample that demonstrates this completely. You can download the sample from the following page.

http://websamples.syncfusion.com/samples/Grid.Windows/F68173/main.htm

Please refer to the sample and let me know if you have any questions.

Regards,
Nagaraj


AB abc September 12, 2007 05:39 AM UTC

thx a lot Nagarajan for a quck reply,

using this code will dissable cursor on all column cells...but in my application some columns are editable and some not. can u pls help me in this.

Thanks & Regards
Prabhjeet

>Hi Prabhjeet,

Thanks for your continued interest in SYncfusion product. To avoid the cursor inside the cell you have to handle TableControlCurrentCellStartEditing event . Please refer to the following code snippet

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;
}


I have attached the sample that demonstrates this completely. You can download the sample from the following page.

http://websamples.syncfusion.com/samples/Grid.Windows/F68173/main.htm

Please refer to the sample and let me know if you have any questions.

Regards,
Nagaraj


J. J.Nagarajan Syncfusion Team September 13, 2007 03:21 AM UTC

Hi Prabhjeet,

You can disable the cursor for a particular column. To achieve this you have to handle TableControlCurrentCellStartEditing. In this event you can check the particular column name to disable the cursor. Please refer to the following code snippet

[C#]
void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && style.TableCellIdentity.Column.Name == "Col1")
e.Inner.Cancel = true;
}

Please refer to the attached sample that demonstrates this. In this sample the editable cursor is disabled for Column1.

http://websamples.syncfusion.com/samples/Grid.Windows/F68173Sep12/main.htm


Please refer to it and let me know if this helps.
Regards,
Nagaraj


ND Nagaraju Dhulipalla replied to J.Nagarajan August 21, 2018 07:10 AM UTC

Hi Prabhjeet,

You can disable the cursor for a particular column. To achieve this you have to handle TableControlCurrentCellStartEditing. In this event you can check the particular column name to disable the cursor. Please refer to the following code snippet

[C#]
void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && style.TableCellIdentity.Column.Name == "Col1")
e.Inner.Cancel = true;
}

Please refer to the attached sample that demonstrates this. In this sample the editable cursor is disabled for Column1.

http://websamples.syncfusion.com/samples/Grid.Windows/F68173Sep12/main.htm


Please refer to it and let me know if this helps.
Regards,
Nagaraj

The following code snippet is not working for me


You can disable the cursor for a particular column. To achieve this you have to handle TableControlCurrentCellStartEditing. In this event you can check the particular column name to disable the cursor. Please refer to the following code snippet


[C#]
void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
if (style.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record && style.TableCellIdentity.Column.Name == "Col1")
e.Inner.Cancel = true;
}

Please refer to the attached sample that demonstrates this. In this sample the editable cursor is disabled for Column1.

http://websamples.syncfusion.com/samples/Grid.Windows/F68173Sep12/main.htm


AA Arulraj A Syncfusion Team August 22, 2018 10:26 AM UTC

Hi Nagaraju, 
 
Thanks for using Syncfusion product. 
 
We have tried to reproduce your scenario using the following sample. But, the sample is working fine as expected. So, please provide the following details to reproduce the reported scenario, 

  • Let us know the TableControlCurrentCellStartEditing event has triggered or not when you click on the cell. If the event has not triggered, please check whether that event has hooked or not.
  • Please provide the Syncfusion version details which you are using currently.
  • Please let us know the below attached sample differ from your customization.

The above details will be helpful to reproduce the reported scenario and it will be helpful to provide the solution at the earliest. 


Arulraj A 


Loader.
Up arrow icon