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

Grid Printing

6 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shivan
Top achievements
Rank 1
Shivan asked on 24 Jan 2011, 01:19 PM
Dear Telerik Team,

I have created grid printing from the sample griven in

http://www.telerik.com/community/code-library/aspnet-ajax/grid/print-radgrid-contents.aspx


My grid has nearly 20 columns and it will not fit in one page.
On giving print, it prints columns which can be fit on the first page and ignores the rest of the columns. It is not printing the rest of the fields on the second page.

Please help me in solving this issue.

Thanks
Shivan

6 Answers, 1 is accepted

Sort by
0
Shivan
Top achievements
Rank 1
answered on 26 Jan 2011, 06:59 AM
Please anyone help me in this issue

Thanks
Shivan
0
Daniel
Telerik team
answered on 27 Jan 2011, 11:07 AM
Hello Shiva,

You could decrease the font size, remove the paddings/margins, etc. Sample code is shown below:
function PrintRadGrid()
{
    var previewWnd = window.open('about:blank', '', '', false);
    var sh = '<%= ClientScript.GetWebResourceUrl(radGrid1.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",radGrid1.Skin)) %>';
    var shBase = '<%= ClientScript.GetWebResourceUrl(radGrid1.GetType(),"Telerik.Web.UI.Skins.Grid.css") %>';
    var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link>";
    var printStyle1 = ".rgRow td, .rgAltRow td, .rgHeader th, .rgHeader a, .rgPager span { font-size: 6pt !important; padding: 0 !important; margin: 0 !important; }";
    var printStyle2 = "input.rgFilterBox { width: 50% !important; }";
    styleStr += "<style type='text/css'>" + printStyle1 + printStyle2 + "</style>";
    styleStr += "<link href = '" + shBase + "' rel='stylesheet' type='text/css'></link></head>";
    var htmlcontent = styleStr + "<body>" + getOuterHTML($find('<%= radGrid1.ClientID %>').get_element()) + "</body></html>";
    previewWnd.document.open();
    previewWnd.document.write(htmlcontent);
    previewWnd.document.close();
    previewWnd.print();
    previewWnd.close();
}

Kind regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Shivan
Top achievements
Rank 1
answered on 28 Jan 2011, 05:58 AM
Hello Daniel,
Thanks for your reply

Decreasing font sometimes may lead to unreadable size? There is no way to vertically cut the table based on selected paper size and print the remaining columns on the next page?

Please help if you have any idea.

Thanks
Shivan

0
Daniel
Telerik team
answered on 02 Feb 2011, 02:08 PM
Hello Shiva,

Of course, if you decrease the fonts too much the document will become unreadable.
As to your question - I do not think there is a way to cut the page this way.

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
soraya
Top achievements
Rank 1
answered on 04 Oct 2013, 02:13 AM
Hello,
I try to print my grid with the same sample but my page doesn't recognize ClientScript, what I am doing wrong??

Thanks
0
Daniel
Telerik team
answered on 08 Oct 2013, 08:21 AM
Hello Soraya,

Please try this example:
print-radgrid-skins-dll.zip

It is taken from the following code-library:
Print RadGrid contents

Regards,
Daniel
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Shivan
Top achievements
Rank 1
Answers by
Shivan
Top achievements
Rank 1
Daniel
Telerik team
soraya
Top achievements
Rank 1
Share this question
or