【发布时间】:2015-06-24 07:09:53
【问题描述】:
我正在使用一个
datagridview,
因为我正在使用一个
datagridviewcomboboxcolumn.
这个datagridview中有三行,因此在datagridviewcomboboxcolumn的每一行中都创建了三个组合框。
这些组合框具有相同的项目,但每个项目的选定索引不同。 例如:假设有A、B、C三个项目。第一个组合框选中的项目是A,第二个有B,第三个有C,所以选中的索引分别是0,1和2。
现在,我正在这样做,
DataTable dt_Groupingdetails;
//Grouping details have changed values Z,B,C for that column(comboboxcolumn).
List<string> list_groups = new List<string>();
this.gView_cBoxgroup.DataSource = className.GetChangedValues();
public static List<string> GetChangedValues()
{
foreach (DataRow drow in dt_Groupingdetails.Rows)
list_groups.Add(drow["comboboxcolumn"].ToString());
return list_groups;
}
当我更改 DataSource 时,每个组合框的选定索引也更改为 0。但我不想更改索引。我只想更新每一行的索引项。
我该怎么做?
【问题讨论】:
标签: c# datagridview datagridviewcombobox datagridviewcomboboxcell