get current record when combobox selectedindex changes

I can I get the current record from the underlying datasource when the selected index of a combo box in the cell of that row chanages.

I am trying to use the TableControlCurrentCellShowingDropDown event, but can't seem to get to the Record.

3 Replies

AD Administrator Syncfusion Team January 19, 2007 08:52 AM UTC

Hi James,

Thanks for being patience.

Please try using e.TableControl.Table.CurrentRecord property in the TableControlCurrentCellShowingDropdown event. The following is the code snippet

>>>>>>>>>>>> Code Snippet <<<<<<<<<<<<<
// TableControlCurrentCellShowingDropdown event
GridComboBoxCellRenderer cr = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer;
if (e.TableControl.Table.CurrentElement.IsRecord)
{
Record currentRecord = e.TableControl.Table.CurrentRecord as Record;
object obj = currentRecord.GetValue("parentID");
===
}
>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<

Have a nice day.

Best regards,
Madhan


JB James Blibo January 29, 2007 06:31 PM UTC

This event is being raised even before the combo box opens or the selected index changes..

I am only interested in the selected index change property, if there is one.

I want to change other parts of the record when the selected index of the cobo box changes. I also want to be able to reset the combo box to its previous value when validate fails.


AD Administrator Syncfusion Team January 30, 2007 01:00 PM UTC

Hi James,

Thank you for being patience.

This can be achieved by handling the TableControlCurrentCellCloseDropDown event. In the event the SelectedValue / SelectedIndex property can be handled to retrieve the selected value from the comboBox.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// TableControlCurrentCellCloseDropDown
GridComboBoxCellRenderer cr = e.TableControl.CurrentCell.Renderer as GridComboBoxCellRenderer;
object value = cr.ListBoxPart.SelectedValue; // SelectedItem;
if (e.TableControl.Table.CurrentElement.IsRecord)
{
Record currentRecord = e.TableControl.Table.CurrentRecord as Record;
switch (value)
{
case "One":
currentRecord.SetValue("Column1", 3);
break;
====
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Please refer to the following KB article for different validation techniques.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340

Have a nice day.

Best regards,
Madhan

Loader.
Up arrow icon