I have a GridView that is unbound. I manually add the rows and the columns, one of which is a GridViewComboBoxColumn (other columns omitted):
var departmentColumn =
departmentColumn.Width = 120;
departmentColumn.DataSource = _departments;
_departments is a list containing a number of Department objects, which have among other things a Name property and an Id property.
I manually add the rows to the grid like this (still, other columns omitted):
var row = grid.Rows.AddNew();
row.Cells.Value = "Department A";
I would like this to result in a new row in the grid, where "Department A" is selected in the list of values in the GridViewComboBoxColumn. However, this doesn't work. Trying to set the name results in a FormatException ("Input string was not in a correct format.")
I feel silly for having to ask because it must be dead simple, but I am stuck!