This is a migrated thread and some comments may be shown as answers.

Printing Grid

4 Answers 77 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 2
Ian asked on 15 May 2013, 04:10 PM
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")

4 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 18 May 2013, 07:28 PM
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
0
Ian
Top achievements
Rank 2
answered on 20 May 2013, 03:05 PM
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? 
0
Emanuel Varga
Top achievements
Rank 1
answered on 21 May 2013, 06:38 AM
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
0
Ivan Petrov
Telerik team
answered on 23 May 2013, 03:12 PM
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?
Tags
GridView
Asked by
Ian
Top achievements
Rank 2
Answers by
Emanuel Varga
Top achievements
Rank 1
Ian
Top achievements
Rank 2
Ivan Petrov
Telerik team
Share this question
or