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

ComboBox Column ReadOnly

Hi, Please let me know, how to make a ComboBox Column ReadOnly. Best regrads, Jamâl-Dine DISSOU

4 Replies

PD Prof DISSOU Jamâl-Dine May 12, 2005 04:23 PM UTC

Hi, I mean how to make a ComboBox Column in GGC (GridGroupingControl). Best regards, Jamâl-Dine


AD Administrator Syncfusion Team May 13, 2005 11:43 AM UTC

I am not sure I understand exactly what you need to be readonly. To make a column readonly, you can set this.gridGroupingControl1.TableDescriptor.Columns["SomeColumn"].ReadOnly = true; If you want to restrict your user to only selecting values in the combobox list, then on the style object where you are setting, style.CellType = "ComboBox", style.DataSource = ???, etc., also set style.DropDownStyle = GridDropDownStyle.Exclusive.


AD Administrator Syncfusion Team June 8, 2005 05:04 PM UTC

I think original poster has the same problem as me. I have a combobox readonly column created in GGC. It seems to be working fine - I cannot type anything in it (dropdown button is hidden). However double-clicking the cell causes values to change. I can probably override double-click event, but may be there is a better way? Below is the sample of how I create 1 column. gridColumnDescriptor.MappingName = column; gridColumnDescriptor.HeaderText = captionText; gridColumnDescriptor.ReadOnly = true; gridColumnDescriptor.Appearance.AnyRecordFieldCell.BaseStyle = ""; gridColumnDescriptor.Appearance.AnyRecordFieldCell.CellType = "ComboBox"; gridColumnDescriptor.Appearance.AnyRecordFieldCell.DataSource = dataSource; gridColumnDescriptor.Appearance.AnyRecordFieldCell.DisplayMember = displayMember; gridColumnDescriptor.Appearance.AnyRecordFieldCell.ValueMember = valueMember; gridColumnDescriptor.Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Left;


AD Administrator Syncfusion Team June 9, 2005 12:23 AM UTC

In 3.2.1.0, there is a property you can set to avoid this behavior. GridComboBoxCellModel cellModel = grid.Model.CellModels["ComboBox"] as GridComboBoxCellModel; cellModel.AllowDoubleClickChangeSelectedIndex = false; In earlier versions, you need to derive the combobox celltype. When double clicked on a combobox cell, the OnEditPartMouseDown method of the combobox cell renderer is called that replaces it with the next item in the dropdown. To cancel it, for now you have to override the OnEditPartMouseDown deriving the cell renderer and cellmodel. Here is the modified sample that does it for read-only cells.

Loader.
Live Chat Icon For mobile
Up arrow icon