[Solved] Refreshing grid from BindingList

1 Answer 54 Views
GridView
Carl
Top achievements
Rank 1
Iron
Iron
Iron
Carl asked on 06 May 2026, 06:24 PM

Given the UI below which is bound to BindingLists implementing INotifyChanged interface, I'm seeing some weird behavior.

If I click on  on a top row like Account or Active Contract, the items under it check/uncheck correctly. I'm doing this via the gvGrids_CellEndEdit event like this:

private void gvGrids_CellEndEdit(object sender, GridViewCellEventArgs e)

{

    string formName = e.Row.Cells["FormDescr"].Value.ToString();

    foreach(var item in gridOptionsListDetail.Where(n => n.FormDescr == formName))
    {
        item.Selected = (bool)e.Value;
    }
}

 

The problem occurs when I click on the checkbox to the left of Form. Doing so fires the HeaderCellToggleStateChanged event:

private void gvGrids_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)

{
    if (e.Column.Name == "Selected")
    {
        ToggleGrids(e.State == Telerik.WinControls.Enumerations.ToggleState.On);

        gvGrids.MasterTemplate.Refresh();

        gvGrids.TableElement.Update(GridUINotifyAction.DataChanged);
    }
}

 

This event will check the Account and Active Contract checkboxes and the ToggleGrids() method will check the Selected property in the underlying BindingList but the subgrid will not refresh unless I scroll down and up again. The weird thing is that If I click the Select All/Deselect All links, which call the same ToggleGrids() method, all works well.

 

What am I missing here?

Thanks

Carl

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 07 May 2026, 11:22 AM

Hello, Carl,

According to the provided code snippets, it seems that the problem is that the child template does not refresh as you update the Selected property in the underlying BindingList. What I can suggest is to reassign the child's data source. Updating the child template's DataSource (setting it to null, then back to the BindingList), will force the child grid to re-read all values and repaint them in accordance with the changed underlying data. This is the most reliable way to force Telerik's RadGridView hierarchy to refresh child rows after the header cell toggle state has changed and thus sync the checked state.

private void gvGrids_HeaderCellToggleStateChanged(object? sender, GridViewHeaderCellEventArgs e)
{
    if (e.Column.Name == "Selected")
    {
        ToggleGrids(e.State == ToggleState.On);

        // Force child template to refresh by re-assigning its DataSource
        var childTemplate = gvGrids.MasterTemplate.Templates[0];
        childTemplate.DataSource = null;
        childTemplate.DataSource = gridOptionsListDetail;

    }
}

I hope this helps. Let me know if you have any other questions.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Carl
Top achievements
Rank 1
Iron
Iron
Iron
commented on 08 May 2026, 08:50 PM

I'm afraid that had no effect. When I click the header checkbox I get this:

If I click Account or Activ Contract for example, the items in the subgrid are all selected. However, once I click the header checkbox these stop working.

Do you see anything odd in the code I attached?

Thanks

Carl

 

Nadya | Tech Support Engineer
Telerik team
commented on 11 May 2026, 12:13 PM

Hello, Carl,

Thank you for providing the whole code snippet. Now I realize that it has different setup compared to my initial setup. I see that you are using GridViewRelation to set up the hierarchy levels, and I used the provided code in Telerik.Ganz.txt to set up a project that can replicate the exact issue. Now I can see clearly what happens. 

When gvGrids_HeaderCellToggleStateChanged(object, GridViewHeaderCellEventArgs) fires, the grid is still processing the header checkbox toggle internally. During this event, the grid suppresses or ignores incoming data-binding updates — so the PropertyChanged notifications from ToggleGrids(bool) are effectively swallowed. To fix this, you need to defer the ToggleGrids(bool) call using BeginInvoke so it runs after the grid finishes its internal toggle processing:

 private void gvGrids_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)
 {
     if (e.Column.Name == "Selected")
     {
         bool toggle = e.State == ToggleState.On;
         this.BeginInvoke(() => ToggleGrids(toggle));
     }
 }

BeginInvoke posts the ToggleGrids(bool) call to the message queue, so it executes after the grid's internal header-checkbox processing completes and the child rows update correctly — the same way they do when triggered from the link labels.

Regards,
Nadya

Tags
GridView
Asked by
Carl
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or