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

[Solved] User radgrid exporte buttons

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 17 Jul 2013, 10:16 AM
Hi all Is it possible to use the export to excel and export to pdf buttons, with other fucntions.

i want to deactivate the expor excel funtion and pdf, and use my own?

is it possible??

Best Regards.

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Jul 2013, 10:24 AM
Hello,

Please try with below code snippet.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"
       OnItemCommand="RadGrid1_ItemCommand">
       <MasterTableView CommandItemDisplay="Top">
           <CommandItemSettings ShowExportToPdfButton="true" />
           <Columns>
               <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID">
               </telerik:GridBoundColumn>
           </Columns>
       </MasterTableView>
   </telerik:RadGrid>
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
   {
       dynamic data = new[] {
           new { ID = 1, Name = "Name1"},
           new { ID = 2, Name = "Name2"},
           new { ID = 3, Name = "Name3"},
           new { ID = 4, Name = "Name4"},
           new { ID = 5, Name = "Name5"}
       };
 
       RadGrid1.DataSource = data;
   }
 
 
 
   protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
   {
       if (e.CommandName == RadGrid.ExportToPdfCommandName)
       {
           e.Canceled = true;
           // Implement your own logic here
       }
   }


Thanks,
Jayesh Goyani
0
Carlos
Top achievements
Rank 1
answered on 17 Jul 2013, 10:56 AM
Thanks

was trying a big code and 1 line is enough.
thanks.
Tags
Grid
Asked by
Carlos
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Carlos
Top achievements
Rank 1
Share this question
or