To reproduce:
- Use the code below on a new grid with 3 combo box columns - computer_id, computer_des, location_id
public static DataTable dsComputerImages = null;
public static DataTable dsLocations = null;
private void loadComputerImagesGrid()
{
dsLocations = new DataTable();
DataColumn newColumn = new DataColumn("location_id", typeof(Int64));
dsLocations.Columns.Add(newColumn);
newColumn = new DataColumn("location_des", typeof(String));
dsLocations.Columns.Add(newColumn);
DataRow newRow = dsLocations.NewRow();
newRow["location_id"] = 1;
newRow["location_des"] = "Boston";
dsLocations.Rows.Add(newRow);
newRow = dsLocations.NewRow();
newRow["location_id"] = 2;
newRow["location_des"] = "New York";
dsLocations.Rows.Add(newRow);
newRow = dsLocations.NewRow();
newRow["location_id"] = 3;
newRow["location_des"] = "Huston";
dsLocations.Rows.Add(newRow);
dsComputerImages = new DataTable();
newColumn = new DataColumn("computer_id", typeof(Int64));
dsComputerImages.Columns.Add(newColumn);
newColumn = new DataColumn("computer_des", typeof(String));
dsComputerImages.Columns.Add(newColumn);
newColumn = new DataColumn("location_id", typeof(Int64));
dsComputerImages.Columns.Add(newColumn);
newRow = dsComputerImages.NewRow();
newRow["computer_id"] = 1;
newRow["computer_des"] = "AAA";
newRow["location_id"] = "1";
dsComputerImages.Rows.Add(newRow);
newRow = dsComputerImages.NewRow();
newRow["computer_id"] = 2;
newRow["computer_des"] = "BBB";
newRow["location_id"] = "1";
dsComputerImages.Rows.Add(newRow);
newRow = dsComputerImages.NewRow();
newRow["computer_id"] = 3;
newRow["computer_des"] = "CCC";
newRow["location_id"] = "2";
dsComputerImages.Rows.Add(newRow);
newRow = dsComputerImages.NewRow();
newRow["computer_id"] = 4;
newRow["computer_des"] = "DDD";
newRow["location_id"] = "3";
dsComputerImages.Rows.Add(newRow);
this.ComputerImagesGrid.AutoGenerateColumns = false;
this.ComputerImagesGrid.DataSource = dsComputerImages;
this.ComputerImagesGrid.AutoSizeRows = true;
}
private void ComputerImagesGrid_DataBindingComplete(object sender, GridViewBindingCompleteEventArgs e)
{
((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).DataSource = dsLocations;
((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).ValueMember = "location_id";
((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).DisplayMember = "location_des";
((GridViewComboBoxColumn)((RadGridView)sender).Columns["location_id"]).DisplayMemberSort = true;
}