this.gridGroupingControl1.TableDescriptor.Columns["Description"].ReadOnly = true;
FieldChooser fieldChooser = new FieldChooser(this.gridGroupingControl1);
this.gridGroupingControl1.FieldChooserShowing += gridGroupingControl1_FieldChooserShowing;
void gridGroupingControl1_FieldChooserShowing(object sender, Syncfusion.Windows.Forms.Grid.FieldChooserShowingEventArgs e)
{
int row, col;
this.gridGroupingControl1.TableControl.PointToRowCol(point, out row, out col);
GridControl control = e.FieldList as GridControl;
if (this.gridGroupingControl1.TableDescriptor.Columns[col - 1].ReadOnly)
{
e.Cancel = true;
}
} |
Hi Gregory,
Thanks for your interest in Syncfusion products.
We have analyzed your scenario and created the simple sample with FieldChooser from what we had understood from your scenario. In that sample, the field chooser dialog has been prevented from opening for read only columns in FieldChooserShowing event. Can you please provide us with some more details of your scenario and let us know your requirement(with field chooser and read only columns) clearly? Please refer to the attached sample.Code example:
this.gridGroupingControl1.TableDescriptor.Columns["Description"].ReadOnly = true;FieldChooser fieldChooser = new FieldChooser(this.gridGroupingControl1);this.gridGroupingControl1.FieldChooserShowing += gridGroupingControl1_FieldChooserShowing;void gridGroupingControl1_FieldChooserShowing(object sender, Syncfusion.Windows.Forms.Grid.FieldChooserShowingEventArgs e){int row, col;this.gridGroupingControl1.TableControl.PointToRowCol(point, out row, out col);GridControl control = e.FieldList as GridControl;if (this.gridGroupingControl1.TableDescriptor.Columns[col - 1].ReadOnly){e.Cancel = true;}}
UG Document:
Sample link:
Regards,Piruthiviraj