• 0
  • 11
  • 0

User Control - DataGridView with combobox columns

May 6 2013 9:46 AM

Trying to build a simple User Control to populate dataGridView with a Table data. Scenario - Table1: RegionID, Region, ManagerID; Table2: PersonID, Name. I'd like to display Region and Name in the grid where the 2nd column is a combobox with all names from Table 2 and also each cell in the col 2 has value based on ManagerID = PersonID. The code is working fine when it's a win app without user control.
dGrRegions.DataSource = ds.Tables[0]; (ds Dataset SELECT RegionID, Region, ManagerID FROM Table1)
dGrRegions.Columns[0].Visible = false;
dGrRegions.Columns[2].Visible = false;
var column = new DataGridViewComboBoxColumn();
column.DataPropertyName = "PersonID";
column.DataSource = dsPeople.Tables[0]; (Dataset SELECT PersonID, Name...)
column.ValueMember = "PersonID";
column.DisplayMember = "Name";
column.HeaderText = "Manager";
but when I create a control and pass all needed info as parameters all works fine except that the col 2 doesn't show current values - it's blank but combobox has all dropdown values
Any idea?

Brought to you by: