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. Image for the cookie policy date

problem with combobox in cell

Hi, I have placed ComboBox in my GridDataBoundGrid object called myGrid. I had binded combobox column using a DataTable object using GridCurrentCellShowingDropDownEventArgs EVENT as shown here. I got the list and working fine. My issue arises while getting the selected value from the ComboBox cell. I used myGrid_CurrentCellCloseDropDown as shown here. I''m getting null value for cb.ControlText.controlValue. Kindly let me WHERE I''m WRONG?? MS ------------------------------------ private void myGrid_CurrentCellShowingDropDown(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellShowingDropDownEventArgs e) { GridControlBase grid = sender as GridControlBase; if(grid != null) { GridCurrentCell cc = grid.CurrentCell; GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; if(cc != null) { GridComboBoxListBoxPart listBoxPart = (GridComboBoxListBoxPart)cr.ListBoxPart; listBoxPart.DataSource = dttblQualification; listBoxPart.DisplayMember = "Qualification"; } } } ------------------------------------------------- private void myGrid_CurrentCellCloseDropDown(object sender, Syncfusion.Windows.Forms.PopupClosedEventArgs e) { GridControlBase grid = (GridControlBase)sender; GridComboBoxCellRenderer cb = (GridComboBoxCellRenderer) grid.CurrentCell.Renderer; string controlText=""; object controlValue = new object(); if(cb != null) { controlText = cb.ControlText; controlValue = cb.ListBoxPart.Text; } myGrid.Model[myGrid.CurrentCell.RowIndex, myGrid.CurrentCell.ColIndex].Text = controlText; myGrid[myGrid.CurrentCell.RowIndex, myGrid.CurrentCell.ColIndex].CellValue = controlValue; }

2 Replies

AD Administrator Syncfusion Team February 8, 2005 10:37 AM UTC

A couple of comments. Setting style.CellValue and style.Text in closedropdown is setting a single value. These two properties in GridStyleInfo are linked to each other and setting one sets both. Also, the grid normally handles setting the values back into itself. Why do you need the code setting values into the grid in closedropdown? What are you trying to accomplish? As far as the null value, try also setting listBoxPart.ValueMember = "Qualification"; to see if that makes things work better.

MS Muthu Swamy February 8, 2005 02:00 PM UTC

Clay Burch, Thanks and this works perfect. --------- listBoxPart.ValueMember = "Qualification"; --------- MS

Live Chat Icon For mobile
Up arrow icon