Printing Grid

5 posts, 0 answers
  1. Ian
    Ian avatar
    7 posts
    Member since:
    Oct 2012

    Posted 15 May 2013 Link to this post

    I have a problem I have a grid that has a commandcolumn in it. When the user tries to print the grid it also prints the commandcolumn which it shouldn't do. So i though i had found a work around for it by making the column not visible when passed the grid to the radprintdoucment. The problem is though when i re-size the margins on the print document it is bringing back the command column. I was wondering if anyone had any idea of how i would go about fixing this. My thought was to do the following, but when i do that if i delete one grids cart column it deletes both of them. How can I delete the cart column in just the TGrid?  

    Dim tGrid As New RadGridView
    tGrid = grdItem
    tGrid.Columns.Remove("cart")
    PrintReport(tGrid, rptname & " Report")

  2. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 18 May 2013 Link to this post

    Hello Ian,

    if you are doing tGrid= grdItem you are actually setting the same reference onto a new variable, thus rendering the creating (tgrid as new ...) useless, might i suggest just creating a new grid, set the datasource from the old grid plus any other extras you need, like filtering, sorting and then print that grid, and disposing of it when done.

    If i've misunderstood the problem, please let me know.

    Best Regards,
    Emanuel Varga MVP
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ian
    Ian avatar
    7 posts
    Member since:
    Oct 2012

    Posted 20 May 2013 Link to this post

    Thank you that is actually a great idea but one last question when i do that they may have changed the size of some of the columns or the sort order of the columns how would I set one grids layout to be the exact same as another grids layout? 
  5. Emanuel Varga
    Emanuel Varga avatar
    1336 posts
    Member since:
    May 2010

    Posted 21 May 2013 Link to this post

    Hello again Ian,

    For this you could use SaveLayout on the first grid to save the layout to a stream, and load it for the second grid, please take a look at the following help link if you need more info on this.

    Hope this helps, if you have any more questions please don't hesitate to ask.

    If this answers your question, please mark all relevant answers.

    Best Regards.
    Emanuel Varga, MVP
  6. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 23 May 2013 Link to this post

    Hello Ian and Emanuel,

    Thank you both for writing.

    What I believe is happening is that you are showing the print preview dialog not as a modal dialog. And by the time the print doc rerenders the grid after you change the margins the column visibility is set back to visible. I would kindly ask you to verify that the print preview dialog is shown as a modal dialog. If this is the case, I would ask of you to send em your project or an example where you can extract the printing logic so I can investigate the situation further.

    If you will be sending a project you will have to open a new support ticket. If you do so please mention this forum thread so we can update the information here as well.

    I am looking forward to your reply.

    Regards,
    Ivan Petrov
    Telerik
    RadChart for WinForms is obsolete. Now what?
Back to Top
UI for WinForms is Visual Studio 2017 Ready