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.

ggc combobox - setting selected item

Thread ID:

Created:

Updated:

Platform:

Replies:

59951 Apr 25,2007 05:49 AM Apr 25,2007 01:24 PM Windows Forms 1
loading
Tags: GridControl
Ryan Hardoon
Asked On April 25, 2007 05:49 AM

Hi,

I managed to define a ggc combobox column using the following code

======================================
StringCollection rows = new StringCollection();
ggc1.TableDescriptor.Columns["Col1"].Appearance.AnyRecordFieldCell.CellType = "ComboBox";
ggc1.TableDescriptor.Columns["Col1"].Appearance.AnyRecordFieldCell.DataSource = rows;
rows.Add("item1");
rows.Add("item2");
...
======================================

I now need to select an item programatically, but I couldn't find any property that relates to the Selected-Index and everything I tried has failed.


(my product version is 4.4.0.5.51)



Thanks in advance.

Rajagopal [Syncfusion]
Replied On April 25, 2007 01:24 PM

Hi Ryan,

The grid does not track ''the selected index''. The only thing its knows is the cell value. The selected index is only around when the dropdown is visible.
You can use the code below in the TableControlCurrentCellCloseDropDown/TableControlCurrentCellShowedDropDown to get at the selected index.

void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e)
{
GridCurrentCell cc = e.TableControl.CurrentCell;
GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer;
if (cr != null)
{
Console.WriteLine(cr.ListBoxPart.SelectedIndex);
}
}

But when there is no combobox dropped or about to be dropped or closed, then there is no selectedindex available.

Let us know if you need any further information.
Regards,
Rajagopal

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.

;