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

Print the Radgrid to printer without opening in any form like pdf

4 Answers 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Subbarao
Top achievements
Rank 1
Subbarao asked on 02 Mar 2010, 05:25 PM
Hi
Is there a way to print the radgrid (ie to export and send it to printer) without opening in pdf/tiff files?

Appreciate your support.
Regards,
SR





4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Mar 2010, 05:30 PM
Hello Subbarao,

There is a code-library dedicated on this subject:
Print RadGrid contents

Regards,
Daniel
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Phillip
Top achievements
Rank 1
answered on 07 Jul 2011, 07:06 PM
This link does not appear to show how to export to pdf and print without opening the pdf. 
0
Daniel
Telerik team
answered on 13 Jul 2011, 10:41 AM
Hello Phillip,

The original question was how to print the radgrid contents and not how to print an exported file. Here is why the aforementioned link will not be suitable for your requirements. That said, printing PDF files is out of the scope of RadGrid control.

Best regards,
Daniel
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Mohammed
Top achievements
Rank 1
answered on 03 Aug 2011, 12:36 PM

Dear,

I'm trying to use this java script but it seems it is not working with me. the grid is placed in side a table.

could you please help

regards,

 <script type="text/javascript">

        function getOuterHTML(obj)

        {

            if (typeof (obj.outerHTML) == "undefined")

            {

                var divWrapper = document.createElement("div");

                var copyOb = obj.cloneNode(true);

                divWrapper.appendChild(copyOb);

                return divWrapper.innerHTML

            }

            else

                return obj.outerHTML;

        }

        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 styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";

    var htmlcontent = styleStr + "<body>" + $find('<%= radGrid1.ClientID %>').get_element().outerHTML + "</body></html>";

    previewWnd.document.open();

    previewWnd.document.write(htmlcontent);

    previewWnd.document.close();

    previewWnd.print();

    previewWnd.close();

}

    </script>

.

.
.
.
.
.<telerik:RadGrid ID="radGrid1" runat="server" GridLines="None" Skin="Office2007" 
                                Width="800px" DataSourceID="SqlDataSource1">
<MasterTableView AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
    <Columns>
    <telerik:GridBoundColumn DataField="Organization" 
            DefaultInsertValue="" HeaderText="Organization" SortExpression="Organization" 
            UniqueName="Organization" >
        </telerik:GridBoundColumn>
        
        <telerik:GridBoundColumn DataField="Governorate" 
            DefaultInsertValue="" HeaderText="Governorate" SortExpression="Governorate" 
            UniqueName="Governorate">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Num. of Projects" DefaultInsertValue="" 
            HeaderText="Num. of Projects" SortExpression="Num. of Projects" 
            UniqueName="Num. of Projects" DataType="System.Int32">
        </telerik:GridBoundColumn>
         
    </Columns>
</MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="True" />
                                </ClientSettings>
                            </telerik:RadGrid>
..

.

.

.

..

 <asp:ImageButton ID="ImageButton3" runat="server"

                                ImageUrl="~/images/Main/Print.png" ToolTip="Cancel" CssClass="style2"  OnClientClick="PrintRadGrid(); return false;"/>

Tags
Grid
Asked by
Subbarao
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Phillip
Top achievements
Rank 1
Mohammed
Top achievements
Rank 1
Share this question
or