Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Parent/Child grid - I want the multi select to work only within the same parent
posted

I have a parent/child relation in ultrawingrid. I want to be able to select multiple child rows but within the same parent. if the user selects from a different parent, i do not want to allow that selection. Is there any way we can do this?

Parents
No Data
Reply
  • 610
    Offline posted

    For our purposes, using BeforeSelectChange wasn't quite what we wanted as you could still have an active row "selected" under a different parent. We ended up using something like this:

    private void ultraGrid1_BeforeRowActivate(object sender, RowEventArgs e)
    {
        var firstSelectedInBand = ultraGrid1.Selected.Rows.OfType()
            .FirstOrDefault(x => x.Band == e.Row.Band);

        if (firstSelectedInBand == null)
            return;

        if (e.Row.ParentCollection != firstSelectedInBand.ParentCollection)
            ugPlan.Selected.Rows.Clear();
    }

Children
No Data