New rows not showing until another action done

4 posts, 0 answers
  1. Eddie
    Eddie avatar
    11 posts
    Member since:
    Jun 2007

    Posted 11 Feb 2009 Link to this post

    Hello,

    I have an app that creates grids programmatically and then populates them (in unbound mode) with data.  However I don't actually see the rows displayed in the grids until I do some other activity.  For example if I add another new row manually, or reorder columns, etc.  then suddenly I will see all the previously added rows.  I tried putting in a call to Refresh() for each grid when I was done adding rows but that didn't seem to help.

            private void populateGroupFactControls() 
            { 
                var level2Grids = from fact in activeJob.FactSet 
                                  where fact.Level == 1 && fact.DataTypeDesc == p.factTypeGroup 
                                  select new 
                                             { 
                                                 GridName = uiUtility.CreateFactGridName(fact.FactName), 
                                                 Rows = 
                                                      from childFact in activeJob.FactSet 
                                                      where childFact.Level == 2 && childFact.ParentFactID == fact.FactID 
                                                      join factValue in activeDataElement.Values 
                                                      on childFact.FactID equals factValue.FactID 
                                                      group factValue by factValue.GroupInstanceID 
                                                      into rowCells 
                                                      select new 
                                                         { 
                                                             RowID = rowCells.Key, 
                                                             Cells = rowCells 
                                                         } 
                                             }; 
     
                foreach(var grid in level2Grids) 
                { 
                    var gridControl = (RadGridView) groupFactTable.Controls.Find(grid.GridName, true).First(); 
                    gridControl.Rows.Clear(); 
                    foreach(var row in grid.Rows) 
                    { 
                        GridViewRowInfo newRow = gridControl.Rows.AddNew(); 
                        newRow.Cells[p.RowID].Value = row.RowID; 
                        foreach(var cell in row.Cells) 
                        { 
                            newRow.Cells[cell.FactID].Value = cell.InstanceValue; 
                        } 
                    } 
                    gridControl.Refresh(); // Doesn't seem to help 
                } 
                groupFactTable.Refresh(); // Doesn't seem to help either 
            } 
     


    Another consideration is that the grids are all being held in a TableLayoutPanel control  (groupFactTable in the above code sample).  I also tried calling the Refresh method for that parent control but that didn't help either.

    I'm using the Jan 2009 version (8.2.0.0) of the RadGridView.  Any thoughts would be greatly appreciated.

    Thanks!

    Eddie

  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 12 Feb 2009 Link to this post

    Hi Eddie,

    Thank you for contacting us.

    You should call the Update method of the GridElement instead of calling the Refresh method. Consider the code snippet below:

     
    gridControl.GridElement.Update(GridUINotifyAction.Reset); 
     


    If this does not help, please send us your application so we can test it and find the best solution. I am looking forward to your reply.

    Kind regards,
    Jack
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Eddie
    Eddie avatar
    11 posts
    Member since:
    Jun 2007

    Posted 12 Feb 2009 Link to this post

    Jack,

    Thanks much for your prompt response.  Unfortunately that did not work either.  I did find a work-around in the meantime: if I change the SortExpressions of the grids via gridControl.MasterGridViewTemplate.SortExpressions.Add() then they do display all the rows properly. 

    I set up a small test project consisting of a simple table layout control and generated two unbound grids within it, then added some rows to them.  Everything worked fine in that case, so it is something about my specific project that is causing the issue.

    My work around is fine for now, because I was going to be adding default sorting to the grids anyways, but I thought I'd post this to the discussion in case any other users ran into the same issue.

    Thanks again for your help!

    -Eddie
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 16 Feb 2009 Link to this post

    Hello Eddie,

    I am glad to hear that you have found a solution for this issue. Do not hesitate to contact us if you have other questions.

    All the best,
    Jack
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top