Hi,
I am populating a dropdown in a cell by setting the datasource to a dynamically generated datatable.
The datatable contains two columns: NAME and NUMBER. The ValueMember and DisplayMember are both set to the NUMBER column and the NAME column is hidden.
When the dropdown value is changed I would like to access the value of the NAME column. How can I do this?
Thank you!
AD
Administrator
Syncfusion Team
February 13, 2007 03:28 PM UTC
Hi Kav,
One way you can do this by using TableControlCurrentCellCloseDropDown event of the grid and get the value of selected item using theRenderer.ListControlPart.SelectedItem. Here is a code snippet
private void gridGroupingControl1_TableControlCurrentCellCloseDropDown(object sender, GridTableControlPopupClosedEventArgs e)
{
GridDropDownGridListControlCellRenderer cr = e.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
if( cr != null)
{
DataRowView drv = cr.ListControlPart.SelectedItem as DataRowView;
if( drv != null )
Console.WriteLine("Slected Name >>> " + drv["Name"]);
}
}
Best regards,
Haneef
AD
Administrator
Syncfusion Team
February 13, 2007 09:08 PM UTC
Thank you for the quick solution!
However, now I am facing a different problem where the dropdown doesnt show up on the first click. But the second and consecutive clicks work fine.
This is what I have for the event:
static void gridAsos_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e)
{
AsosDataset.AsosRogTableDataTable asosRogDT = new AsosDataset.AsosRogTableDataTable();
GridGroupingControl ggc = sender as GridGroupingControl;
GridDropDownGridListControlCellRenderer cr = e.TableControl.CurrentCell.Renderer as GridDropDownGridListControlCellRenderer;
Record currentRecord = e.TableControl.Table.CurrentRecord as Record;
cr.ListControlPart.ShowColumnHeader = false;
cr.ListControlPart.Grid.Cols.Hidden[2] = true;
int dpac = (int)currentRecord.GetValue("BITM_NUMB");
ggc.TableDescriptor.Columns["DSD_ROG_NUMB"].Appearance.AnyRecordFieldCell.DataSource = DSDAsosDAO.GetRogList(dpac);
}
AD
Administrator
Syncfusion Team
February 13, 2007 09:10 PM UTC
Sorry forgot to log in!
AD
Administrator
Syncfusion Team
February 14, 2007 10:28 PM UTC
Hi Kav,
Sorry for the delay in updating you.
We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the any of our browser sample to reproduce the issue here? This will help us to analyse the issue further.
Thanks for your patience.
Best Regards,
Haneef