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

How to print radgrid with controls in it?

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jayesh
Top achievements
Rank 1
Jayesh asked on 07 Jan 2014, 05:07 AM
Hi,

I want to print a radgrid from client side, and am using the code below. it is working fine.But, one of the column is having textarea control. So it is printing the textarea, instead i want to print text inside that control in that column. can we do it with some javascript?  Thanks in advance. 

var previewWnd = window.open('about:blank', '', '', false);
        var sh = '<%= Page.ClientScript.GetWebResourceUrl(GridData.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",GridData.Skin)) %>';
        var styleStr = "<html><head><link href='" + sh + "' rel='stylesheet' type='text/css' /></head>";
        var htmlcontent = styleStr + "<body>" +  $find('<%= GridData.ClientID %>').get_element().outerHTML + "</body></html>";
        previewWnd.document.open();
        previewWnd.document.write(htmlcontent);
        previewWnd.document.close();
        previewWnd.print();
        previewWnd.close();

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 09 Jan 2014, 04:10 PM
Hi Jayesh,

In order to print only the text you would need to extract the content of the textarea control. An approach on how this could be achieved is discussed in this article. After that you would need to replace the textarea tags with the extracted text or with other tags (possibly <span>).

Regards,
Viktor Tachev
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
Jayesh
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or