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

ExportToPdf broken for columns containing a link

4 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
david
Top achievements
Rank 1
david asked on 23 Jul 2008, 08:16 PM
I have a column in my grid that I have changed the text to (something like) "<a href='#'>blah</a>" and the ExportToPdf no longer works. Sometimes it gives an xml error, sometimes it just produces a 0 byte pdf.

I notice that if you just make the contents "<" the same thing happens. Looks like the converter is just assuming that the column values are plain text!

My columns contain data that must be a valid link that the user can click on.

Please advise.

Thanks

4 Answers, 1 is accepted

Sort by
0
david
Top achievements
Rank 1
answered on 23 Jul 2008, 09:21 PM
Well, it's worse than I thought. Even if there is just a "<" (possibly other characters) in the DATA of the column, the converter barfs. I did not check this before because I just assumed the data would be sanitised either before display or at least before you guys tried to process the html as xml...

Can you promote this forum post to a ticket or do I need to do that myself?

Thanks.
0
Sebastian
Telerik team
answered on 24 Jul 2008, 07:02 AM
Hello David,

This is a known issue with the PDF export feature which is mentioned in the bottom section of this RadGrid documentation topic:

http://www.telerik.com/help/aspnet-ajax/grdexport.html

You will need to ensure your grid content is valid XHTML and that you closed all tags within the grid body.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
david
Top achievements
Rank 1
answered on 24 Jul 2008, 01:24 PM
Hello Stephen, thanks for your prompt reply,

I was under the impression that the anchor tag was valid XHTML, see: http://www.w3schools.com/TAGS/tag_a.asp

Please advise me if it is otherwise... It's not like I am plugging in naked < characters, the column text as far as I can see IS valid XHTML.

Besides that, say there were other characters in there that were not valid, or say I were to want to remove the anchors before export, what mechanism do you provide for that? Is the only way to copy the entire grid to a new one and then export from that? How would to apply the filters and sorting orderings?

I'm sorry but it still looks like a bug to me. It should be the grid's job to ensure that its own output is compatible with functions that it claims to provide over that data at a later point in time. From my perspective, I am just providing the grid with a dataset that came from a database - I am not manipulating each cell's text value before giving it to the grid...

Thanks. Hopefully you can get back to me quickly as this issue is now fairly urgent... The export was working, but now that I see some real data there are anchors (hyperlinks) within the text for some columns.
0
Nikolay Rusev
Telerik team
answered on 25 Jul 2008, 03:20 PM
Hello David,

As I can see you are using:
"<href='#'>blah</a>"  

The "#" symbol is not valid XHTML. You can escape it and have your anchor tag like this
<href="%23">Your text</a> 
This is working just fine.

Regarding your other questions:
I suggest you visit the RadGrid export section in our online help.  You can use IgnorePaging property to specify whether all records will be exported or merely those on the current page. Find the rest of the properties listed in the linked article.

Best regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
david
Top achievements
Rank 1
Answers by
david
Top achievements
Rank 1
Sebastian
Telerik team
Nikolay Rusev
Telerik team
Share this question
or