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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Suppress cell combo box

Thread ID:





25524 Mar 1,2005 05:45 AM UTC Jun 7,2005 08:20 AM UTC WinForms 5
Tags: GridControl
Asked On March 1, 2005 05:45 AM UTC

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

Administrator [Syncfusion]
Replied On March 1, 2005 09:04 AM UTC

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.

Administrator [Syncfusion]
Replied On June 6, 2005 04:58 AM UTC

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

Administrator [Syncfusion]
Replied On June 6, 2005 07:44 AM UTC

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.

Administrator [Syncfusion]
Replied On June 7, 2005 02:41 AM UTC

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

Administrator [Syncfusion]
Replied On June 7, 2005 08:20 AM UTC

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;


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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