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.
Unfortunately, activation email could not send to your email. Please try again.

changing the DataTable of a combobox in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

42962 Apr 11,2006 05:12 AM Apr 11,2006 06:22 AM Windows Forms 1
loading
Tags: GridControl
Fady Sayegh
Asked On April 11, 2006 05:12 AM

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

Administrator [Syncfusion]
Replied On April 11, 2006 06:22 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;