Print functionality in rad grid

6 posts, 0 answers
  1. Ashbin
    Ashbin avatar
    4 posts
    Member since:
    Oct 2014

    Posted 27 Jun Link to this post

    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.
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 28 Jun Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ashbin
    Ashbin avatar
    4 posts
    Member since:
    Oct 2014

    Posted 28 Jun Link to this post

    Tina Stancheva,

    I am using radgrid for ASP.NET AJAX component.

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 01 Jul Link to this post

    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.
  6. Ashbin
    Ashbin avatar
    4 posts
    Member since:
    Oct 2014

    Posted 28 Jul in reply to Viktor Tachev Link to this post

    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();
    }

  7. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 01 Aug Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017