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
45
RowSelectionChanged and RowIslands
posted

Hi,

I'm trying to get the second cell of a second-level row when I select a first-level row.

When RowSelectionChanged fires I have only the second-level row of the "first first-level" row (see the example)

    protected void whgCells1_RowSelectionChanged(object sender, SelectedRowEventArgs e)
    {
       
        String sProjID;
        String sCellName;

        if (e.CurrentSelectedRows.Count > 0)
        {
            GridRecord oRow = e.CurrentSelectedRows[0];
            ContainerGrid oRowIsland =  whgCells1.GridView.Rows[e.CurrentSelectedRows[0].Index].RowIslands[0];

                sProjID = oRowIsland.Rows[0].Items[1].Value.ToString();
                sCellName = oRow.Items[0].Value.ToString();

                //Other stuff...

        }

    }

e.CurrentSelectedRows[0] is a first-level row on the Grid. It has a RowIsland with only one row (all rows in this level has a RowIsland with one row).

This example works ONLY if I select FIRST row on first-level hierarchy, on other row the object

whgCells1.GridView.Rows[e.CurrentSelectedRows[0].Index].RowIslands[0].Count

is equal to 0.

However, whgCells1.GridView.Rows[e.CurrentSelectedRows[0].Index].HasRowIslands is set to true for all first-level rows.

Thanks and regards,

Javier Ferrer.

  • 70
    posted

    Same error for me.

    It's strange but when i try to get the selected rows of my WebHierarchicalDataGrid, that is self referenced, if it has only 2 level, it work correctly but if it has 3 or more level (because parent-child-child relation), I see that .HasRowIslands is set to true but .RowIslands.Count is equal to 0.

    Any idea why?