Home Forums WinForms controls Xceed Grid for WinForms Master/Detail grids

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14075 |

    Hello,

    I need to know if a grid.CurrentRow in a Master/Detail grid has “childrens”. How can i know that in code?

    Thanks.

    Imported from legacy forums. Posted by Javier (had 2781 views)

    User (Old forums)
    Member
    Post count: 23064

    <pre>Xceed.Grid.DataRow row = grid.CurrentRow as Xceed.Grid.DataRow;
    if (row != null) {
    if (row.DetailGrids.Count > 0) {
    // current row has detail grids
    }
    }</pre>

    Imported from legacy forums. Posted by Tommy (had 192 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks Tommy, that works fine.

    Imported from legacy forums. Posted by Javier (had 185 views)

    User (Old forums)
    Member
    Post count: 23064

    Tommy,

    I have tested the code and with

    row.DetailGrids.Count > 0

    you know if the current row has detailgrids defined (always have), but to really see if there is child data in the row i have to add

    if (row.DetailGrids[0].DataRows.Count > 0)

    so the code is:

    Xceed.Grid.DataRow row = (Xceed.Grid.DataRow)grid.CurrentRow;
    if (row != null)
    {
    if (row.DetailGrids.Count > 0)
    {
    if (row.DetailGrids[0].DataRows.Count > 0)
    bHasChildres = true;
    }
    }

    Thanks.

    Imported from legacy forums. Posted by Javier (had 3994 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.