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.

ComboBox Column ReadOnly

Thread ID:

Created:

Updated:

Platform:

Replies:

28935 May 12,2005 12:17 PM Jun 8,2005 08:23 PM Windows Forms 4
loading
Tags: GridControl
Prof DISSOU Jamâl-Dine
Asked On May 12, 2005 12:17 PM

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

Prof DISSOU Jamâl-Dine
Replied On May 12, 2005 12:23 PM

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

Administrator [Syncfusion]
Replied On May 13, 2005 07:43 AM

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.

Administrator [Syncfusion]
Replied On June 8, 2005 01:04 PM

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;

Administrator [Syncfusion]
Replied On June 8, 2005 08:23 PM

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.

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.

;