Hi guys,
I have been asked to output the RadGrid content to a PDF. I have used the following formatting code to do the formatting when the item is being created.
Note: that the Grid uses GroupBy headings (in which I am having trouble formatting)
Protected Sub RadGrid_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgResults.ItemDataBound |
If (TypeOf e.Item Is GridDataItem OrElse TypeOf e.Item Is GridHeaderItem) Then |
'to align the field left in the PDF even tho it looks ok on the webpage |
For Each cell As TableCell In e.Item.Cells |
cell.Style("text-align") = "left" |
Next |
Select Case e.Item.ItemType 'Mimic RadGrid appearance for the exported PDF file |
Case GridItemType.Item |
e.Item.Style("background-color") = "#E8E8E8" |
Exit Select |
Case GridItemType.AlternatingItem |
e.Item.Style("background-color") = "#FFFFFF" |
Exit Select |
Case GridItemType.GroupHeader |
e.Item.Style("background-color") = "#000000" |
e.Item.Style("color") = "#FFFFFF " |
Exit Select |
Case GridItemType.Header |
e.Item.Style("background-color") = "#000000" |
e.Item.Style("color") = "#FFFFFF" |
Exit Select |
End Select |
End If |
End Sub |
Im assuming that the following code will format the groupby headings in the table however in the PDF it is in plain black text and not with a black background and white text:
Case GridItemType.GroupHeader
e.Item.Style("background-color") = "#000000"
e.Item.Style("color") = "#FFFFFF "
Exit Select
Any comments will be grateful,
Thanks