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

Suppress cell combo box

Thread ID:

Created:

Updated:

Platform:

Replies:

25524 Mar 1,2005 12:45 AM Jun 7,2005 04:20 AM Windows Forms 5
loading
Tags: GridControl
Richard
Asked On March 1, 2005 12:45 AM

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 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.

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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;

CONFIRMATION

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.

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.

;