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

    I design one programes display infomation, Program consit many detail Grid
    I want return value in detail Grid

    Code:

    For Each detail As DetailGrid In Me.grdTTHC.DetailGridTemplates
    If detail.Tag = DetailTree Then

    For Each row As Xceed.Grid.DataRow In detail.DataRows
    msgbox(row.cells(0).value)
    Next
    End If
    Next

    Value detail.Datarows allway =0

    Help me!

    Imported from legacy forums. Posted by Nguyen Duy (had 3042 views)

    User (Old forums)
    Member
    Post count: 23064

    This is because you are using the DetailGridTemplates collection, which is, as its name mentions, a template. This does not give you access to the actual instances of the DetailGrids. To gain access to a specific instance of a DetailGrid, you need to first get an instance of the DataRow to which the DetailGrid is attached, and then loop through the collection of DetailGrids on that row, and then the row.Cells(0).Value will return valid values.

    //So first loop through the rows
    For Each row as Xceed.Grid.DataRow In Me.grdTTHC.DataRows

    //Then do as you did, but on the main row
    For Each detail as DetailGrid In row.DetailGrids

    If detail.Tag = DetailTree Then

    For Each row As Xceed.Grid.DataRow In detail.DataRows
    msgbox(row.cells(0).value)

    Next
    End If
    Next
    Next

    Imported from legacy forums. Posted by André (had 212 views)

    User (Old forums)
    Member
    Post count: 23064

    I can’t perform

    When I used help which you voice, Value Return = Value in detail Grid chile cua Master Grid

    Examples: CSDL consit 2 Table

    Table1:
    +id_cay_tthc: Primarykey
    +ten
    +id_parent

    Table2:
    +id_tthc
    + ten_tthc
    +id_cay_tthc

    1 record in Table1 Relationship with n record in Table 2
    n id_cay_tthc in Table1 Relationship with 1 id_parent in Table1

    After I build Tree:
    A
    +C
    . Record 1 in Table 2
    . Record 2 in Table 2
    +D
    B
    +E
    +F

    When I change data in detail Grid consit list Record 1,..n in Table2. Now, i want save changed

    I can’t Return Value list in detail Grid
    Help me!

    If use help i can Return Value list in detail Grid ( Value in node C, D, E, F)
    But I want Return Value Record1,…Record n in Detail Grid

    Imported from legacy forums. Posted by Nguyen Duy (had 321 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m not sure if I understand what you are trying to do, but if you want to retrieve the rows of a DetailGrid that is attached to a master grid row, you need to do something like this :

    //first, fine the master grid row you want to use, for example
    Xceed.Grid.DataRow row = gridControl1.DataRows[ 0 ];
    //or
    //Xceed.Grid.DataRow row = ( Xceed.Grid.DataRow )gridControl1.CurrentRow;

    //get the detail grid (if you have more then one detail grid, you can loop through the DetailGrids collection)
    DetailGrid grid = row.DetailGrids[ 0 ];

    //then retrieve the rows attached to this master grid row
    foreach( Xceed.Grid.DataRow detailRow in grid.DataRows )
    {
    System.Diagnostics.Debug.WriteLine( .Cells[ 0 ].Value.ToString() );
    }

    Imported from legacy forums. Posted by André (had 4008 views)

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