I have datagridview
which has three columns in which two columns are simple non- editable text columns.Third one is a combo box column.If I change a value from dropdown of combo box and click another cell, value is reset to default.Selection changed is not retained.
Which event should I handle the selection change? How do I retain the value in combo box selection?
I am attaching data source in the below mentioned
DataGridViewComboBoxColumn checkType = (DataGridViewComboBoxColumn)grdCheck.Columns[(int)CheckColumn.CheckType];
CheckType.DisplayMember = "Name";
CheckType.ValueMember = "Name";
CheckType.DataSource = CheckTypes();
whereas CheckTypes() contains
CheckTypes()
{
var CheckTypes = new[]
{
new { Name = "None", Id = "1" },
new { Name = "View", Id = "2" },
new { Name = "Edit", Id = "3" }
};
return CheckTypes;
}
I have not added events here as I have a save button which saves the selection directly from datagridview to database.