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

Export to Excel(inbuilt in grid) with RadAjaxManagerProxy

2 Answers 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saurabh
Top achievements
Rank 1
Saurabh asked on 09 Mar 2011, 12:52 PM
Hi There,

I have a radgrid that is placed on the usercontrol. Grid is under RadAjaxManagerProxy.
I am not able to use the inbuilt Export to excel property of the grid

Although I have searched for the same and found that its because of asynchronous post back,
I have also written client side event(OnRequestStart) for the radajaxmanager on pageload event of the usercontrol, but not able to use the export inbuilt functionality.
Kindly suggest how to achieve this.

 RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);

           if (manager != null)
            {
                manager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest);
                manager.ClientEvents.OnRequestStart = "onAJAXResponseStart";
                manager.ClientEvents.OnResponseEnd = "onAJAXResponseEnd";
            }


     

        function onAJAXResponseStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {

                args.set_enableAjax(false);
            }
            else {
                args.set_enableAjax(true);
            }

        }


Thanks
Saurabh

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 14 Mar 2011, 10:23 PM
Hello Saurabh,

Instead of trying to add the event programmatically, I recommend that you use declarative approach. Go to the (master) page that contains the RadAjaxManager (not the proxy) control and add the event in the markup.
        function onRequestStart(sender, args)
        {
            if (args.get_eventTarget().indexOf("Export") >= 0)
                args.set_enableAjax(false);
        }
    </script>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" ClientEvents-OnRequestStart="onRequestStart" ...

I hope this helps.

Regards,
Daniel
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Saurabh
Top achievements
Rank 1
answered on 15 Mar 2011, 11:27 AM
Hi Denial

I have to separate grid on the same page. For first grid Export to excel,pdf,csv.word functionality renders result on the same page however for second grid opens file save dialog box for excel,csv,word except pdf.
Both grid have the same properties and is under RadAjaxManagerProxy with the dynamic master page( master page is reside on the sharepoint ).

Kindly do the needful asap as it is very urgent for me.
Tags
Grid
Asked by
Saurabh
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Saurabh
Top achievements
Rank 1
Share this question
or