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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

prevent combobox cell from dropping down

Thread ID:





22932 Dec 29,2004 06:12 PM UTC Dec 29,2004 07:04 PM UTC WinForms 2
Tags: GridControl
Jeff Lancaster
Asked On December 29, 2004 06:12 PM UTC

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 06:35 PM UTC

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 07:04 PM UTC

Excellent! Thanks Clay.


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon