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

Export to PDF & Footer Rowcount + style Error

7 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 30 Oct 2008, 04:11 PM

In the RadGrid1_ItemDataBound I have the following piece of code for displaying the number of records returned in the grids footer. 


GridBoundColumn 
recordCount = RadGrid1.MasterTableView.GetColumn("FieldOne") as GridBoundColumn;  
recordCount.Aggregate = GridAggregateFunction.Count;  
recordCount.FooterText = "<strong style='Font-size:10pt;color:red;'>Rows Returned: "
   

However, when I click to export the results to a PDF and only a PDF the error below shows up. The Excel and Word work just fine.  The style tag I added is causing this issue.... :(

Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.
Parse error:
The 'strong' start tag on line 697 does not match the end tag of 'td'. Line 697, position 84.
at line:
<td>&nbsp;</td><td><strong style='Font-size:10pt;color:red;'>Rows Returned: 10</td><td>&nbsp;</td><td>&........

My question is how can I apply a style to the number of rows returned in my footer so the PDF export does not throw an error?  Also, is there a better place to show the number or rows returned?

Thank You!

 

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Oct 2008, 04:19 AM
Hi Mike,

Go through the following KB article which explains how to export styles in PDF.
Exporting styles in PDF

Shinu
0
Polina
Top achievements
Rank 1
answered on 14 Jan 2009, 03:50 PM
The link does not work anymore.
Where can i find this article? thank you
0
Daniel
Telerik team
answered on 14 Jan 2009, 04:31 PM
Hello,

I attached a sample project to this post. It illustrates how to apply custom styles to the PDF file.

I hope this helps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Polina
Top achievements
Rank 1
answered on 14 Jan 2009, 04:37 PM
Thank you very much
this is helpfull.
0
Mike
Top achievements
Rank 1
answered on 15 Jan 2009, 02:38 PM
How can I hide a column in the export to PDF?
0
Sebastian
Telerik team
answered on 15 Jan 2009, 02:47 PM
Hello Mike,

You can hide the column explicitly by setting its Visible property to false prior to the export operation (call to the ExportToPDF() method of the master table). Review the information/code snippets from the help topic pointed below for further details:

http://www.telerik.com/help/aspnet-ajax/grdexporttipstricks.html (paragraph 'Exporting GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn data')

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike
Top achievements
Rank 1
answered on 15 Jan 2009, 02:52 PM
But it doesn't seem to be working for me and the GridTemplateColumn.  I guess that I could assign a DataField from the stored procedure not being using in the grid to be the key that would allow me to use FindByDataField and that works.

if I am missing something on the GridTemplateColumn and hiding it another way let me know, ok! 

 

 

<telerik:GridTemplateColumn HeaderText="Actions"....   
 

Grid1.MasterTableView.Columns.FindByUniqueName("Actions").Visible = false

 I am also getting the following error on this code during my Intem_DataBound

 

 

Object reference not set to an instance of an object.   
Description: An unhandled exception occurred during the execution of the current web request. 
Please review the stack trace for more information about the error and where it originated in the code.   
 
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.  
 
Source Error:   
 
 
Line 112:  {  
Line 113:  case ((int)Enumeration.RefreshStatus.Failed):  
Line 114:       message.Text = Convert.ToString(dataItem["ERROR_MESSAGE"].Text);  
Line 115:       imageMessage.Text = Convert.ToString(dataItem["ERROR_MESSAGE"].Text);  
Line 116:       imageResults.Visible = true;  
   
 

 

 

 

 

 

 

 

 

Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Polina
Top achievements
Rank 1
Daniel
Telerik team
Mike
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or