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.

How do I programmatically scroll thru a combobox in a cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

40923 Feb 16,2006 10:24 AM Feb 17,2006 10:25 AM Windows Forms 2
loading
Tags: GridControl
Maxim Software Systems
Asked On February 16, 2006 10:24 AM

I have a GridControl with a ColumnStyle whose CellType is set to "CombobBox". The DataSource for the combobox column is set to a collection of objects. Is it possible to programmatically scroll up or down through the values?

stanleyj [Syncfusion]
Replied On February 17, 2006 08:22 AM

Hi Don, see if Style.DropDownStyle = GridDropDownStyle.AutoComplete helps. If the dropdown is to be dropped on changing values, then use this code to show the dropdown. private void gridDataBoundGrid1_CurrentCellChanged(object sender, System.EventArgs e) { GridComboBoxCellRenderer renderer = this.gridDataBoundGrid1.CurrentCell.Renderer as GridComboBoxCellRenderer; if(this.gridDataBoundGrid1.CurrentCell.Renderer.StyleInfo.CellType == "ComboBox") { this.gridDataBoundGrid1.CurrentCell.ShowDropDown(); } } The above idea is to scroll the value when editing. If your requirement is different and you need to locate the selected index programmatically, then see if this piece of information helps. The ComboBox CellType uses the ListBox for the dropdown and button is derived from GridCellButton and ComboBox is not directly implemented. The ListBox can be handled through the ListBoxPart to the instance of theGridComboBoxCellRenderer. this.gridDataBoundGrid1.Focus(); this.gridDataBoundGrid1.CurrentCell.MoveTo(3,2); // ComboBox cell this.gridDataBoundGrid1.CurrentCell.ShowDropDown(); GridComboBoxCellRenderer renderer = this.gridDataBoundGrid1.CurrentCell.Renderer as GridComboBoxCellRenderer; renderer.ListBoxPart.SelectedIndex = i; // to select programmatically Best regards, Stanley

Maxim Software Systems
Replied On February 17, 2006 10:25 AM

Thanks for the info. I managed to get the functionality I needed by grabbing the existing value of the cell and using my custom collection class to determine what the previous/next value should be, then setting that new value back into the cell. But hopefully what you''ve posted will help someone else in the future.

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.

;