Hello,
I was unchecking a cell programmatically and was expecting the same behavior as when I uncheck it through the UI, but it seems that the header checkbox is not updated when you modify a cell's value programmatically:
private
void
RadForm1_Load(
object
sender, EventArgs e)
{
radGridView1.AllowSearchRow =
true
;
radGridView1.TableElement.SearchHighlightColor = Color.Orange;
radGridView1.AutoExpandGroups =
true
;
DataTable dt =
new
DataTable();
dt.Columns.Add(
"test"
,
typeof
(
bool
));
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
dt.Rows.Add(
true
);
radGridView1.DataSource = dt;
((Telerik.WinControls.UI.GridViewCheckBoxColumn)radGridView1.Columns[0]).EnableHeaderCheckBox =
true
;
((Telerik.WinControls.UI.GridViewCheckBoxColumn)radGridView1.Columns[0]).Width = radGridView1.Width - 50;
radGridView1.TableElement.Update(Telerik.WinControls.UI.GridUINotifyAction.Reset); //force header checkbox to check
radGridView1.TableElement.ScrollTo(15, 0);
}
private
void
radButton1_Click(
object
sender, EventArgs e)
{
radGridView1.Rows[0].Cells[0].Value =
false
;
}
I have tried adding radGridView1.TableElement.BeginUpdate() to the beginning & radGridView1.TableElement.EndUpdate() to the end of radButton1_Click, along with radGridView1.TableElement.Update(Telerik.WinControls.UI.GridUINotifyAction.ExpandedChanged) & radGridView1.TableElement.Update(Telerik.WinControls.UI.GridUINotifyAction.Reset) immediately after changing the cell's value, but all of these lines seem to invalidate the RadGridView in one way or another. They cause the search row's buttons to flicker and scroll the RadGridView up to the top.
Is there a solution to this problem that will result in behavior similar to checking/unchecking a cell using the UI?
Thank you!