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.

prevent combobox cell from dropping down

Thread ID:

Created:

Updated:

Platform:

Replies:

22932 Dec 29,2004 01:12 PM Dec 29,2004 02:04 PM Windows Forms 2
loading
Tags: GridControl
Jeff Lancaster
Asked On December 29, 2004 01:12 PM

I have a databound grid which contains a GridBoundColumn which I initialize with a CellType of "ComboBox". I then set the DataSource, DisplayMember, and ValueMember in order to display the proper value in the cell. For certain rows, however, I need to set the cells to readonly which I do by setting e.Style.ReadOnly = True in the grid.model.QueryCellInfo routine. Although this prevents the user from selecting a different choice it does not prevent the combobox from displaying the drop down. I tried setting e.Style.CellType = "Static" for these cells in PrepareViewStyleInfo, however this caused the cell to no longer display the DisplayMember. Is there a way to retain the properties of the ComboBox cell while dynamically preventing it from showing the dropdown?

Administrator [Syncfusion]
Replied On December 29, 2004 01:35 PM

You can handle the grid.CurrentCellShowingDropDown event and cancel it if the currentcell is readonly.
private void gridControl1_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(this.gridControl1[cc.RowIndex, cc.ColIndex].ReadOnly)
		e.Cancel = true;
}

Jeff Lancaster
Replied On December 29, 2004 02:04 PM

Excellent! Thanks Clay.

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.

;