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

[Solved] Rad grid save & print

3 Answers 192 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dwarak kanniah
Top achievements
Rank 1
dwarak kanniah asked on 11 Jan 2010, 06:28 AM
Hi.

I am Creating radgrid dynamically with gridhyperlinkcolumns .I am able to create grid dynamically but when i export to excel the header is blank.Is there anyway to solve this issue.


Is there any option to disable the  rad grid skin while printing alone.....


Thanks
Dwarak.K

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 11 Jan 2010, 08:13 AM
Hello Dwarak,

When exporting invisible RadGrid you should first show it (and rebind) otherwise it won't work as expected.
Word/Excel export (HTML-based)

As to the second question - you could use the following code-library - just don't put the skins in the output window:
Print RadGrid contents

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
dwarak kanniah
Top achievements
Rank 1
answered on 11 Jan 2010, 09:41 AM

Hi Daniel........

Regarding to print,I have following queries.....
1)The code for printing the contents of datagrid works fine in internet explorer but it is not printing in

Firefox...........
2)If I enable client settings scrolling and resizing to true,and if i choose 50 items in a page it prints the items

in only in the first page,but it leaves the second page,.Is there any option in such a way that both client settings are enabled and also mulitiple pages is printed.......


Thanks
Dwarak.K



0
Daniel
Telerik team
answered on 13 Jan 2010, 02:16 PM
Hello Dwarak,

outerHTML works in Internet Explorer only. Please try the following:
<script type="text/javascript">
 
    function getOuterHTML(object)
    {
        var element;
        if (!object) return null;
        element = document.createElement("div");
        element.appendChild(object.cloneNode(true));
        return element.innerHTML;
    }
 
    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>" + getOuterHTML($find('<%= radGrid1.ClientID %>').get_element()) + "</body></html>";
        previewWnd.document.open();
        previewWnd.document.write(htmlcontent);
        previewWnd.document.close();
        previewWnd.print();
        previewWnd.close();
    }
     
</script>

2. You should disable the paging as demonstrated in the attached project.

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
dwarak kanniah
Top achievements
Rank 1
Answers by
Daniel
Telerik team
dwarak kanniah
Top achievements
Rank 1
Share this question
or