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

RadGrid Export feature in Grouped report

2 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ajay
Top achievements
Rank 1
Ajay asked on 27 May 2011, 01:33 PM
Hi,

I am using a RadGrid with grouping enabled. I am trying to export this grid data to a PDF but its not happening. On click of export button the grid does some processing but don't work at last.
Below is my code:

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" language="javascript">
        function requestStart(sender, args)
        {
            if (args.get_eventTarget().indexOf("DownloadPDF") > 0)
                args.set_enableAjax(false);
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="CPH" runat="server">
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">

        <telerik:RadGrid ID="radGridShippedOrders" runat="server" GridLines="None" AllowPaging="True"
            PageSize="10" AllowSorting="True" AutoGenerateColumns="false" ShowStatusBar="true"
            HorizontalAlign="NotSet" AllowMultiRowEdit="false" OnNeedDataSource="radGridShippedOrders_NeedDataSource" 
            Width="100%" AllowMultiRowSelection="False" AllowFilteringByColumn="true" ShowGroupPanel="True">
            <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"></PagerStyle>
            
            <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true">
                 <Pdf PageTitle="SushiBar menu" />
            </ExportSettings>

            <MasterTableView GroupLoadMode="Client" CommandItemDisplay="Bottom">
                <CommandItemTemplate>
                    <asp:Button ID="DownloadPDF" runat="server" CommandName="ExportToPdf" Text="Export" />
                </CommandItemTemplate>
                <CommandItemSettings ShowExportToExcelButton="true" />
                <Columns>
                    <telerik:GridBoundColumn UniqueName="OACONO" HeaderText="OACONO" DataField="OACONO">
                    </telerik:GridBoundColumn>                
                    <telerik:GridBoundColumn UniqueName="OAINNO" HeaderText="OAINNO" DataField="OAINNO">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="OAORNO" HeaderText="OAORNO" DataField="OAORNO">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="OAORGN" HeaderText="OAORGN" DataField="OAORGN">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn UniqueName="OAHSSQ" HeaderText="OAHSSQ" DataField="OAHSSQ">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
             <ClientSettings AllowGroupExpandCollapse="True" ReorderColumnsOnClient="True" AllowDragToGroup="True"
                AllowColumnsReorder="True">
            </ClientSettings>
             <GroupingSettings ShowUnGroupButton="true" />
        </telerik:RadGrid>
        
    </telerik:RadAjaxPanel>
</asp:Content>

protected void Page_Load(object sender, EventArgs e)
        {
            RadAjaxManager AjaxManager = new RadAjaxManager();
            AjaxManager = (RadAjaxManager)this.Master.FindControl("RadAjaxManagerMP");
            if (AjaxManager != null)
            {
                AjaxManager.ClientEvents.OnRequestStart = "requestStart";
            }
        }

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 30 May 2011, 09:46 PM
Hello Ajay,

I don't recommend that you use RadAjaxPanel and RadAjaxManager side by side.
For basic scenarios I suggest you use RadAJaxPanel. On the other hand, if your scenario is a complex one, you may prefer to use RadAjaxManager given its flexibility.
Judging by your code, you have ajaxfied RadGrid two times hence the problem.
Ajaxifying controls wrapped in RadAjaxPanel and added to RadAjaxManager settings

Best regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Ajay
Top achievements
Rank 1
answered on 02 Jun 2011, 11:46 AM
Hi Daniel,

Thanks for the help, it worked.
However now I am facing another issue.

The parent RadGrid is having a child radGrid inside a NestedViewTemplate and this childRadGrid is having a export button.
I don't want a full page post back when someone clicks on the expand button, so I ajaxified the grid, but after doing this the export is not working.
So I added below line in page_load:
AjaxManager.AjaxSettings.AddAjaxSetting(radGridShippedOrders, radGridShippedOrders, null);

After the above line everything works fine (export and ajax loading) but the grid keeps displaying the loading icon in bottom left even after the request ends.

Thanks
Ajay
Tags
Grid
Asked by
Ajay
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Ajay
Top achievements
Rank 1
Share this question
or