Looping the childgridviewtemplates childrows

3 posts, 0 answers
  1. gerbrand
    gerbrand avatar
    78 posts
    Member since:
    Mar 2009

    Posted 30 Mar 2009 Link to this post


    I have a hierarchy in the gridtable view.
    Now I want to get the childrows of the selected items in the mastergridviewtemplate.

    Like this:
    foreach (var masterrow in rgvAdserverNetwork.MasterGridViewTemplate.Rows) 
        var childRows = masterrow.ViewTemplate.ChildGridViewTemplates[0].GetChildRows(masterrow); 
        foreach( var child in childRows) 
          foreach(GridViewCellInfo cell in child.Cells) 

    Now I get an NullReference on the cell.Value.

    When I look in de debugger the child.Cells.Count is triggering this.

    What am I doing wrong here?

    Tried several things, everytime the same error...

    Thanks a lot in advance
  2. gerbrand
    gerbrand avatar
    78 posts
    Member since:
    Mar 2009

    Posted 31 Mar 2009 Link to this post

    Okay I found the solution on the forum.

    Had to take a better look at the forum before posting this question.

    The thing is that you have to expand the childs. 

    Here is it explained:

    This sentence should be added in the help files under the subject : "Iterating the child rows collection of a chosen parent row inhierarchy RadGridView"

    => "To access the child row cells you have to expand hierarchy before iterating. So IsExpanded=true is needed, because RadGridView uses virtualization. Child cells do not get create before the child view is expanded."

  3. Nick
    Nick avatar
    767 posts

    Posted 31 Mar 2009 Link to this post

    Hello gerbrand,

    Thank you for contacting us. There is an online documentation topic about your question. Do not hesitate to write us back if you have further questions.

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top