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

Override ExportToExcel function

1 Answer 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Morten asked on 10 Aug 2010, 04:17 PM
I like the look of the default commanditem, and have set <CommandItemSettings ShowExportToExcelButton="true".

However, I like to control the exporting to excel myself.

I was thinking to write my own exporting code in the grid.ItemCommand:

    Select Case e.CommandName
      Case "ExportToExcel"
       [Export to Excel code]

However, the built in exporting still fires.

1 Answer, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 10 Aug 2010, 09:58 PM
Hello Morten,

You should cancel the command as demonstrated below:
Protected Sub RadGrid1_ItemCommand(source As Object, e As GridCommandEventArgs)
    If e.CommandName = RadGrid.ExportToExcelCommandName Then
        e.Canceled = True
    ....
    End If
End Sub

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
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Daniel
Telerik team
Share this question
or