Printing grid in loop issue grid data does not refresh

5 posts, 0 answers
  1. Tomas
    Tomas avatar
    10 posts
    Member since:
    Apr 2017

    Posted 13 Jan Link to this post

    Hi, I have a loop where I am filling the grid and immediatelly print the grid. All printed documents have the same grid values of the last loaded records to the grid DataSource. Is there something I can do to properly print the grid with correct cell values from actual records?

    foreach (var run in _runsToPrint)
    {
        FillReportedAnalytesGrid();
        PrintPreview.PrintGrid(rgvReportedAnalytes, run);
    }
     private void FillReportedAnalytesGrid()
    {
        var records = provider.GetReportedResults();
        rgvReportedAnalytes.DataSource = null;
        rgvReportedAnalytes.DataSource = records;
        rgvReportedAnalytes.BestFitColumns(BestFitColumnMode.AllCells);
        rgvReportedAnalytes.Refresh();
    }

     

    public static void PrintGrid(RadGridView view, string run)
    {
        var document = new RadPrintDocument();
        view.Print(false, document);
    }
  2. Tomas
    Tomas avatar
    10 posts
    Member since:
    Apr 2017

    Posted 13 Jan in reply to Tomas Link to this post

    I found the issue. It was my fault. I did not properly refreshed the records. I confirm that printed grids look good now. Even BestFitColumns command is applied while it seems on the screen that was not applied.

    rgvReportedAnalytes.BestFitColumns(BestFitColumnMode.AllCells);

     

  3. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4176 posts

    Posted 13 Jan Link to this post

    Hello, Tomas,   

    I am glad that the problem you were facing is now resolved. From a first sight, your code looked OK. 

    Please have in mind that it would be greatly appreciated in future if you can provide a sample runnable project demonstrating the undesired behavior that you are facing. Thus, we would be able to make an adequate analysis of the precise case and provide further assistance. Otherwise, we can make only conjectures what causes the issue on your end since it is not clear what is the exact setup that you have according to the provided brief information.  Thank you in advance for your cooperation.

    If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

  4. Tomas
    Tomas avatar
    10 posts
    Member since:
    Apr 2017

    Posted 14 Jan in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Dess,

    I understand, in future I will prepare runnable project. This was quite specific project connected to our company environment, but I could refactor it and prepare some mock classes to generate fake records.

    Cheers,

    Tomas

  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4176 posts

    Posted 14 Jan Link to this post

    Hello, Tomas,

    Thank you for your understanding. Of course, you can use any sample data just to simulate the behavior you are facing. It is not obligatory to provide the original project. Usually, the exact data is not a factor in such cases so you can populate the grid with any dummy data.

    Off topic, note that most of the forum threads are reviewed by Telerik representatives and sometimes we address the questions asked by our customers in the forums as well. However, a post in the forum doesn't guarantee you a response from the Telerik support team. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.  

    Should you have further questions please let me know.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Back to Top