Hello,
I have an SfDataGrid that I use for creating purchase orders. As such, usually the user adds new rows as required and selects a product using a ComboBox. Image below (sorry text is in Spanish).
However, I now need to fill this table automatically without any user input. I have gone so far as to making the rows show up correctly... except for the ComboBox column. It shows up blank (and the CellComboBoxSelectionChanged event is not fired as a consequence, making other columns like price not update correctly).
I cannot seem to find a way to change the selected item or index of the GridComboBoxColumn. How may I achieve this?
If it is worth mentioning, the GridComboBoxColumn.DataSource is an object.
Any help is appreciated, thanks.
Hi, Mohanram
I will try my best to explain myself.
I have an SfDataGrid that has a GridComboBoxColumn. I want to change the selected item of the ComboBox programmatically so that the CellComboBoxSelectionChanged event fires. I can set the text in the column but this does not fire said event.
Cheers
Gerardo
|
private void button1_Click(object sender, System.EventArgs e)
{
this.sfDataGrid1.MoveToCurrentCell(new RowColumnIndex(1, 6));
this.sfDataGrid1.CurrentCell.BeginEdit();
this.sfDataGrid1.BeginInvoke(new Action(() =>
{
(this.sfDataGrid1.CurrentCell.CellRenderer.CurrentCellRendererElement as SfComboBox).SelectedIndex = 3;
}));
} |