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.

Make a combobox non editable

Thread ID:

Created:

Updated:

Platform:

Replies:

97186 Nov 4,2010 03:10 PM Nov 15,2010 12:35 AM Windows Forms 3
loading
Tags: GridControl
David Mecteaux
Asked On November 4, 2010 03:10 PM

In certain circumstances I want to make a combobox not editable.

Currently I do something like:

GridTableCellStyleInfo csi = gtd.Columns[rf.FieldName].Appearance.AnyRecordFieldCell;

csi.ReadOnly = false;
csi.CellType = "ComboBox";
csi.DropDownStyle = GridDropDownStyle.Exclusive;

But the user can still click the drop down button and see the other selections (but can't select a new one). Is there a way to prevent the user from seeing the other selections?


Jisha Joy [Syncfusion]
Replied On November 8, 2010 12:33 AM

Hi David,

To cancel showing the dropdownlist for read-only cells, you can handle the TableControlCurrentCellShowingDropDown event as shown below:

// Event Handler
this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventHandler(gridGroupingControl1_TableControlCurrentCellShowingDropDown);

// Method Invoked
void gridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellShowingDropDownEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);
if (cc.Renderer is GridComboBoxCellRenderer && style.ReadOnly)
{
GridComboBoxCellRenderer rend = cc.Renderer as GridComboBoxCellRenderer;
rend.ListBoxPart = null;
}
}

Regards,
Jisha


David Mecteaux
Replied On November 12, 2010 10:55 AM

Thank you Jisha,

That worked quite nicely.


Jisha Joy [Syncfusion]
Replied On November 15, 2010 12:35 AM

Hi David,

Thank you for your update.

Regards,
Jisha


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.

;