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

Feature Request for RadGrid

3 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 07 Jul 2010, 06:56 PM
Hello,

I think that a "Print" button would be extremely helpful if it were built into the RadGrid control. I think that many different users would find a print feature beneficial. It would be great if it were added and there were options that could be set to: 

  1. Print RadGrid
  2. Print Selected Rows Only
  3. Print Master RadGrid & any detail tables
  4. Print Master/Detail rows and page break when the DataKeyField value of the Master Table View changed
(example)
MASTER ROW
DETAIL ROW
DETAIL ROW
PAGE BREAK
MASTER ROW
DETAIL ROW
DETAIL ROW

Thanks!
Casey

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 13 Jul 2010, 12:02 PM
Hello Casey,

Thank you for your feature request - I passed it to our development team. In the meantime I recommend that you use the approach, demonstrated in the following code-library project:
Print RadGrid contents

Best 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
Casey
Top achievements
Rank 1
answered on 21 Jul 2010, 03:31 PM
Daniel,

Thanks for the link. That works for printing the RadGrid as it is shown on the screen. However, I also need to have the print link print the RadGrid with each Master record, and the associated details, on different pages. Is it possible to print the RadGrid with page breaks when the master record changes?

PAGE 1
1st MASTER RECORD
DETAILS
DETAILS
PAGE 2
2nd MASTER RECORD
DETAILS
DETAILS
PAGE 3
3rd MASTER RECORD
DETAILS
DETAILS

Thanks,
Casey
0
Daniel
Telerik team
answered on 27 Jul 2010, 11:57 AM
Hello Casey,

You can try the following approach:
function PrintRadGrid()
{
    var docType = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd\">";
    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 shBase = '<%= ClientScript.GetWebResourceUrl(radGrid1.GetType(),"Telerik.Web.UI.Skins.Grid.css") %>';
    var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link><style type='text/css'> table.rgMasterTable>tbody>tr>td>table.rgDetailTable { page-break-after: always; } </style>";
    styleStr += "<link href = '" + shBase + "' rel='stylesheet' type='text/css'></link></head>";
    var htmlcontent = docType + styleStr + "<body>" + getOuterHTML($find('<%= radGrid1.ClientID %>').get_element()) + "</body></html>";
    previewWnd.document.open();
    previewWnd.document.write(htmlcontent);
    previewWnd.document.close();
    previewWnd.print();
    previewWnd.close();
}

Please note that this won't work in Firefox since it doesn't support the page-break* tags.

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
Tags
Grid
Asked by
Casey
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Casey
Top achievements
Rank 1
Share this question
or