changing the DataTable of a combobox in GridDataBoundGrid

Hi to all, i''m using the GridDataBoundGrid control. i have a column that contains a combobox of countries and another one that contains the cities. when i choose in the first the country i want to refresh the second with the cities of that country. i made this line of code : DataSet oDsUSACities = new DataSet(); GridDataBoundGrid oGridDataBoundGrid = ((GridDataBoundGrid) sender); if (oGridDataBoundGrid.CurrentCell.ColIndex == 2) { if (gridDataBoundGrid2[oGridDataBoundGrid.CurrentCell.RowIndex, oGridDataBoundGrid.CurrentCell.ColIndex].CellType == "ComboBox") { if (int.Parse(gridDataBoundGrid2[oGridDataBoundGrid.CurrentCell.RowIndex, oGridDataBoundGrid.CurrentCell.ColIndex].CellValue.ToString()) == 1) FillDatasetCitiesOfUSA(ref oDsUSACities); } // gridDataBoundGrid2[oGridDataBoundGrid.CurrentCell.RowIndex, oGridDataBoundGrid.CurrentCell.ColIndex + 1].DataSource = oDsSyndicats2.Tables["TABLE_CITIES2"]; gridDataBoundGrid2.GridBoundColumns[2].StyleInfo.DataSource = oDsSyndicats2.Tables["TABLE_CITIES2"]; } my datagrid must look like this : First combo Second combo 1 USA Washington New york Miami 2 England London Liverpool Manchester 3 France Paris Marseille Lyon best regards and thanks in advance fady

1 Reply

AD Administrator Syncfusion Team April 11, 2006 10:22 AM UTC

Hi Fady, This can be achieved by using the CurrentCellCloseDropDown event. In the event, the datasource / cellvalue of the second column can be changed depending on the value selected in the first combobox column. Refer to this forum thread for more details : Forum_42073 KB article : How do I change the DataSource of one ComboBox cell depending upon the value selected in another ComboBox cell in a GridDataBoundGrid? Best regards, Madhan

Loader.
Up arrow icon