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

Suppress cell combo box

I have columns of Combo Boxes in my grid, and I want to suppress the drop down on the combo from appearing when the cell is read only, here is the code that I have so far private void GroupingGrid_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e) { int intCol; intCol = (e.Inner.ColIndex - this.GroupingGrid.TableDescriptor.GroupedColumns.Count) - 1; // check to see if this is an add new record row, GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex] as GridTableCellStyleInfo; if(style != null && style.TableCellIdentity.TableCellType == GridTableCellType.AddNewRecordFieldCell) { if (this.GroupingGrid.TableDescriptor.Columns[intCol].Name == "Class") { GroupingGrid.TableDescriptor.Columns["Class"].ReadOnly = false; } } else { // make sure this is the correct column if (this.GroupingGrid.TableDescriptor.Columns[intCol].Name == "Class") { GroupingGrid.TableDescriptor.Columns["Class"].ReadOnly = true; } } } I can successfully turn the read only on and off, but how do I also suppress the drop down

5 Replies

AD Administrator Syncfusion Team March 1, 2005 04:04 AM

Try handling the QueryCellStyleInfo event. In your handler, if e.TableCellIdentity points to the cell you want to make readonly and not show a combobox, you can set e.Style.ReadOnly = true and e.Style.ShowButtons = GridShowButtons.Hide.


AD Administrator Syncfusion Team June 6, 2005 12:58 AM

Is there any way, I can just do this once for the whole column, eg grid.TableDescriptor.Columns[GetMappedName("SomeColumn")].ReadOnly = true; that does the readonly, but there does not seem to be an equivalent for the showbuttons. I really would like to avoid using querycellstyleinfo if possible


AD Administrator Syncfusion Team June 6, 2005 03:44 AM

You can use: grid.TableDescriptor.Columns[GetMappedName("SomeColumn")].ShowButtons = GridShowButtons.Hide; But if you have earlier set the ReadOnly property = true, you will need to ttemporarily set grid.IgnoreReadOnly = true; so you can make changes to the style.


AD Administrator Syncfusion Team June 6, 2005 10:41 PM

This does not compile, I get the error Syncfusion.Windows.Forms.Grid.Grouping.GridColumnDescriptor does not contain a definition for ShowButtons I am using version 3.201.1.1


AD Administrator Syncfusion Team June 7, 2005 04:20 AM

Sorry. GridShowButtons is a style property. So, look for it under the column''s Appearance property. grid.TableDescriptor.Columns[GetMappedName("SomeColumn")].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Hide;

Loader.
Live Chat Icon For mobile
Up arrow icon