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

How would that be possible to overwrite the PdfExport functionality?

2 Answers 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pooya
Top achievements
Rank 1
Pooya asked on 26 Jul 2011, 09:54 AM
I'd need to display an Export to Pdf icon to the RadGrid control (CommandItemSettings.ShowExportToPdfButton = true) but with a custom implementation of my own as I'm using an external tool for the export to pdf.

How would that be possible to overwrite the default PdfExport functionality?

Please advise.

Many thanks,

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Jul 2011, 10:43 AM
Hello Pooya,

Try the following CSS:
<style type="text/css">
   .RadGrid_Default .rgExpPDF
    {
     background:url(../Images/customimage.jpg) !important;    
    }
</style>

Thanks,
Princy.
0
Pooya
Top achievements
Rank 1
answered on 26 Jul 2011, 11:12 AM
I talked about its functionality implementation; didn't mean the the icon.

 I'd like to attach an EventHandler of my own to the Click event of the Export button and implement my own export implementation rather than the default one..

I have gone this far but don't know how to remove the existing click event handlers:

protected virtual void RdGridItemCreated(object sender, GridItemEventArgs e)
        {
            var itemType = e.Item.ItemType;
            switch (itemType)
            {                
                case GridItemType.CommandItem:
                    {
                        var gridCommandItem = e.Item as GridCommandItem;

                        var exportToPdfButton = gridCommandItem.FindControl("ExportToPdfButton") as Button;
                         
                        // not sure: exportToPdfButton.RemoveAllEventHandlers();
                         
                        exportToPdfButton.Click += ExportToPdfButtonClick;

                        PageUtil.RegisterPostBackControl(exportToPdfButton);
                            
                        break;
                     }
                    default:
break;
                    }
            }
        }

Or do you recommend I create a new Custom Link Button? How to add it to the CommandItems section?

Thanks,
Tags
Grid
Asked by
Pooya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Pooya
Top achievements
Rank 1
Share this question
or