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

Adding Extra Information to PDF file or Excel file when you export a grid

1 Answer 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
andieje
Top achievements
Rank 1
andieje asked on 20 Jul 2009, 10:38 PM
Hello

Please can you advise me how you add extra information to a pdf file and an excel file when you export a grid.

I have seen that i can add some custom information in the CommandItemTemplate but I cannot find any real information about how i populate the controls etc that I put in the template.

The best that i have been able to see is something like this in the page pre render event

 Protected Sub Page_PreRender(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.PreRender  
        Dim l As Label = RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem)(0).FindControl("lblSomeLabel")  
        l.Text = "some text" 
    End Sub 

However I do not know if this is the best/efficient way of doing this.

Thanks

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Jul 2009, 08:35 AM
Hello Andieje,

Another possible way to add custom text in the CommandItem is to use the ItemCreated event:
Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs) 
    If TypeOf e.Item Is GridCommandItem Then 
        'e.Item.Cells(0).Text = "my text" .... 
    End If 
End Sub 

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
andieje
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or