ChildView vs SelectedRow

Posted by: babe59 on 8 September 2017, 3:16 pm EST

  • Posted 8 September 2017, 3:16 pm EST

    Hello,

    I try to find selected row for selected childView.

    I've 3 master rows and 4 rows in childview for each master rows
    all row are expand.
    I've just click on second childview and on second row on this child view

    this code return :
    sheet.GetChildView(0,0).activeRowIndex => get me "0"
    sheet.GetChildView(1,0).activeRowIndex => get me "1"
    sheet.GetChildView(2,0).activeRowIndex => get me "0"

    but how could I know witch childview I must use (child view index 1 in my case)?
    thks
  • Replied 8 September 2017, 3:16 pm EST

    Hello Babe59,

    You may use the code below to get the parent row index in the 'CellClick' event of Spread :

    if (e.View.Parent != null)
    {
    MessageBox.Show("Parent Row Index" + e.View.GetSheetView().ParentRowIndex);
    }


    Once you have the parent row index you may use it to get that particular child view.

    Hope it helps.

    Thanks,
    Ankita
  • Replied 8 September 2017, 3:16 pm EST

    Yes, It's ok on CellClick event but I'm not in an event.
    The user select multiple rows and he click on a button to apply modification on this selected rows.
    I would like find selected row without event...

    Else I must memorize selected rows on CellClick event to use on my button event click... (not nice)
  • Replied 8 September 2017, 3:16 pm EST

    I found this :

    to find selected rows on main grid =>
           CellRange[] cr = sheet.GetSelections();


    to find selected rows on child grid =>
            CellRange[] cr = sheet.GetChildView(n, 0).GetSelections();
  • Marked as Answer

    Replied 8 September 2017, 3:16 pm EST

    Hello Babe59,

    You may use the below code if you want to get the selected rows in a button click event or in any other method :

    FarPoint.Win.Spread.SpreadView view = fpSpread1.GetRootWorkbook().GetActiveWorkbook();
    //get the parent row
    int i = view.GetSheetView().ParentRowIndex;
    MessageBox.Show(i.ToString());
    //get the selection
    CellRange[] cr = fpSpread1.ActiveSheet.GetChildView(i,0).GetSelections();


    Hope it solves your problem.

    Thanks,
    Ankita
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels