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.
Syncfusion Feedback

How to catch SelectedIndexChanged event of Combobox Column in GDBG?

Thread ID:

Created:

Updated:

Platform:

Replies:

27829 Apr 19,2005 11:04 AM UTC Apr 21,2005 07:16 AM UTC Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On April 19, 2005 11:04 AM UTC

I want to catch the SelectedIndexChanged event of ComboBox Column in GDBG as a normal Combobox control in C#. But GDBG doesn''t support it. How can I do that ? Thanks

Administrator [Syncfusion]
Replied On April 19, 2005 11:28 AM UTC

Generally you would use the CurrentCellChanged event to catch when the selected index of a combobox changed. But if you want to get at the SelectedIndexCahnged event you can. Note that there is only one combobox and it is shared among all cells that have a ComboBox CellType so you will need to take this into consideration as you catch this event. You catch add code like this in Form.Load to subscribe to the event for all cells. GridComboBoxCellRenderer cc = this.grid.CellRenderers["ComboBox"] as GridComboBoxCellRenderer; cc.ListBoxPart.SelectedIndexChanged += new EventHandler(combo_SelectIndexChanged);

Administrator [Syncfusion]
Replied On April 20, 2005 08:35 AM UTC

Yes, you''re right. I should use the CurrentCellChanged event instead of using SelectedIndexChanged event. Now, I want to know the valuemember in any cells which have a ComboBox CellType instead of displaymember. I try to use : GridCurrentCell cc = dgr.CurrentCell; GridComboBoxCellRenderer cb = cc.Renderer.Control as GridComboBoxCellRenderer; and use cb.ListBoxPart.SelectedValue.ToString(); But It makes an error. How to resolve this problem,please? I want to get it in any cells which have a ComboBox CellType, not just in CurrentCell. Thanks >Generally you would use the CurrentCellChanged event to catch when the selected index of a combobox changed. > >But if you want to get at the SelectedIndexCahnged event you can. Note that there is only one combobox and it is shared among all cells that have a ComboBox CellType so you will need to take this into consideration as you catch this event. > >You catch add code like this in Form.Load to subscribe to the event for all cells. > >GridComboBoxCellRenderer cc = this.grid.CellRenderers["ComboBox"] as GridComboBoxCellRenderer; >cc.ListBoxPart.SelectedIndexChanged += new EventHandler(combo_SelectIndexChanged); > > >

Administrator [Syncfusion]
Replied On April 20, 2005 09:37 AM UTC

The ListBoxPart is only around when the combobox is dropped. It has been destoryed by the time CurrentCellChanged is hit. To get the displaymember, try cc.Renderer.ControlText To get the ValueMember, try cc.Renderer.ControlValue

Administrator [Syncfusion]
Replied On April 21, 2005 03:16 AM UTC

But I want to get valuemember not only in CurrentCell,but also in the other cells which are ComboBox CellType .

Administrator [Syncfusion]
Replied On April 21, 2005 07:16 AM UTC

If the cell is not current, then grid[rowIndex, colIndex].Cellvalue should return the ValueMember and grid[rowIndex, colIndex].FormattedText should return the DisplayMember. When a cell is actively being edited, you need to go through the Renderer to get these values.

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.

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

;