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

Print functionality in rad grid

8 Answers 504 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ashbin
Top achievements
Rank 1
Ashbin asked on 27 Jun 2016, 08:28 AM
I have implemented  a server side pagination in my rad grid and I have set VirtualItemCount as the maximum row count of the table. In RadGridPageIndexChanged i have bind the radgrid dynamically calling the server side sp. I want to print the whole record of the table. Could you please help me to print the data of all record through javascript.

8 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 28 Jun 2016, 08:20 AM
Hello Ashbin,

As you posted your request under the Telerik Platform forums, I cannot tell for sure which RadGrid component you're using.

We provide grid components for multiple platforms - WPF, WinForms, Silverlight, ASP.NET AJAX and therefore I would recommend that you post your queries under the forum of the specific product. This will ensure that your questions reach the respective development community and our support specialists. You can also take advantage of our support plans to be able to submit support requests directly for the DevCraft products and have a guaranteed 24 hour response time.

Regards,
Tina Stancheva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ashbin
Top achievements
Rank 1
answered on 28 Jun 2016, 08:37 AM

Tina Stancheva,

I am using radgrid for ASP.NET AJAX component.

0
Viktor Tachev
Telerik team
answered on 01 Jul 2016, 07:27 AM
Hi Ashbin,

The print feature prints only what is shown on the screen. If you would like to print all records in RadGrid you would need to disable paging first (set AllowPaging=false).

Regards,
Viktor Tachev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Ashbin
Top achievements
Rank 1
answered on 28 Jul 2016, 10:55 AM

Thanks for the previous response. I am able to print the content of radgrid.

I want to add css of Radgrid in my print functionality. How can i add skin of radgrid?

function PrintGridRecords(topthml, radGridE) {
    radGridE.ClientSettings.Scrolling.AllowScroll = false;
    radGridE.ClientSettings.Scrolling.UseStaticHeaders = false;
    radGridE.ClientSettings.Scrolling.SaveScrollPosition = false;
    var previewWindow = window.open('about:blank', '', '', false);
 
    var style = '<style>body{margin:5px;width:794px;font-size:11px;font-family:Arial,Helvetica, sans-serif;background-color:#FFFFFF;} table {border-collapse: collapse;}';
    style += '.rgMasterTable { width:100%; border: 1px solid black;} .rgMasterTable th{font-size:12px !important; border: 1px solid black;}';
    style += '.rgMasterTable td { padding:5px; text-align:center;font-size:10px !important;} a {color: black;text-decoration:none !important;}';
    style += ' div.RadGrid .rgPager .rgAdvPart  { display:none !important;   } ';
    style += styles;
    style += '</style>';
 
    var htmlContent = "<html><head>";
     
 
    htmlContent += style + "</head>";
    htmlContent = htmlContent + "<body><div id='topWrapper'> " + topthml + "</div>";
    htmlContent = htmlContent + "<div style='padding: 6px; width:100%;' >" + radGridE.get_element().outerHTML + "</div></body>";
    var script = '<script src="../Scripts/Library/Jquery/jquery-1.9.1.min.js"></script>';
    script += '<script>$(".rgPager").hide();</script>';
    htmlContent += script + "</html>";
    previewWindow.document.open();
    previewWindow.document.write(htmlContent);
 
    previewWindow.focus();
    previewWindow.print();
    previewWindow.document.close();
}

0
Viktor Tachev
Telerik team
answered on 01 Aug 2016, 01:01 PM
Hi Ashbin,

The RadGrid provides print functionality out of the box since R2 2016. There is no need to use custom code in order to print the contents of RadGrid. Check out the following resources that describe the feature in more detail and illustrate how it works.



Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Nguyen Huu
Top achievements
Rank 1
answered on 26 Jun 2019, 04:46 AM

Hi Viktor Tachev,

Thanks your replies, however I got some issues for demos at https://demos.telerik.com/aspnet-ajax/grid/examples/functionality/printing/defaultcs.aspx?isNew=true.

Some columns data of grid missed when a method print called. How do I got all column data of grid by print method?

Thanks!

0
Nguyen Huu
Top achievements
Rank 1
answered on 26 Jun 2019, 05:09 AM

hi Viktor Tachev,

Please review file attached

0
Peter Milchev
Telerik team
answered on 28 Jun 2019, 01:46 PM
Hello Nguyen,

The columns are not visible because the width of the grid is bigger than the max width of the printing page. 

To fix that, you should resize the grid prior printing so that it fits the page.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Ashbin
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Ashbin
Top achievements
Rank 1
Viktor Tachev
Telerik team
Nguyen Huu
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or