Hello!
I have a problem updating my sql db with my radGridView after successful binding. One of my sql column has 'bit' type, so the radGridView has a column with checkboxes. After I check/uncheck one of the checkboxes, it doesn't update my SQL unless I select another cell. Is there any solution to this problem? I use this event:
private void radGridView1_CellValueChanged(object sender, GridViewCellEventArgs e)
{
itemsTableAdapter.Update(telerikDataSet);
ordersTableAdapter.Update(telerikDataSet);
}
(I use table hierarchy. 'Orders' table is the parent, 'Items' table is the child. This is ok. I managed to solve that if I check the checkbox in the parent, all its child checkboxes will be checked too). This way:
private void radGridView1_ValueChanging(object sender, ValueChangingEventArgs e)
{
if (radGridView1.SelectedRows[0].Cells[3].ColumnInfo.HeaderText == "Closed")
{
if (radGridView1.SelectedRows[0].Cells["Closed"].IsCurrent)
{
foreach (GridViewRowInfo item in radGridView1.SelectedRows)
{
GridViewHierarchyRowInfo hierarchyRow = item as GridViewHierarchyRowInfo;
if (hierarchyRow != null)
{
GridViewInfo currentView = hierarchyRow.ActiveView;
foreach (GridViewInfo view in hierarchyRow.Views)
{
hierarchyRow.ActiveView = view;
foreach (GridViewRowInfo row in hierarchyRow.ChildRows)
{
radGridView1.ValueChanging -= radGridView1_ValueChanging;//without this getting infinite loop...
row.Cells[4].Value = e.NewValue;
ordersTableAdapter.Update(telerikDataSet);
itemsTableAdapter.Update(telerikDataSet);
radGridView1.ValueChanging += radGridView1_ValueChanging;
}
}
hierarchyRow.ActiveView = currentView;
}
}
}
}
}
Of course every other fields are working fine when I edit them: as soon as I hit enter, it updates SQL. But checkbox doesn't need enter...
Thanks for your help.