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

RadGrid + ObjectDataSource + IgnorePaging + Export = Empty

8 Answers 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 24 Jun 2011, 12:54 PM
Hi,

I have a RadGrid wired up to an ObjectDataSource.

When I export with IgnorePaging set to False, it works fine, but only exports the current page of results (20 results).

When I export with IgnorePaging set to True, it exports the column headers, but no results.

How do I get it to return all the results from the ObjectDataSource?

Thanks,

Rob

8 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 30 Jun 2011, 05:02 PM
Hello Robert,

As I replied in the support ticket, I don't know how to reproduce this problem. Could you please let me know how to modify the sample project so that I can recreate the problem?

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
Scott Hannon
Top achievements
Rank 1
answered on 26 Sep 2011, 09:04 PM
I am having the exact same problem. I have another project where the grid is bound directly to a SQLDataSource and does NOT have the problem. Are there specific settings like viewstate that may affect the export? I have the "AJAX turned off" workaround found elsewhere on this site. There is nothing out of the ordinary, except a custom commanditemtemplate that has a custom delete radtoolbarbutton on a radtoolbar, and which also implements the default export buttons. There is no custom implementation for the export buttons. Partial markup below. Maybe I need the sample project to check my work against?

<ExportSettings IgnorePaging="True" ExportOnlyData="True" OpenInNewWindow="True"
    FileName="MyGroupExport" HideStructureColumns="True">
    <Pdf Author="my company" Creator="my company"
        DefaultFontFamily="sans-serif" AllowCopy="True" />
    <Excel Format="HTML" FileExtension="xls" />
</ExportSettings>
<MasterTableView DataSourceID="objDSAssignData" CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="False"
    CommandItemSettings-ShowExportToExcelButton="True" CommandItemSettings-ShowExportToPdfButton="True"
    CommandItemSettings-ShowExportToWordButton="True" CommandItemSettings-ShowRefreshButton="False">
    <CommandItemTemplate>
    <div style="display:inline-block; width:100%;">
    <div style="float:left;">
        <telerik:RadToolBar ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick" runat="server"
            Height="30px" Skin="WebBlue" OnClientButtonClicking="clientbuttonclick">
            <Items>
                <telerik:RadToolBarButton Text="Delete selected" CommandName="DeleteSelected"
                    ImageUrl="~/images/Delete.gif">
                </telerik:RadToolBarButton>
            </Items>
        </telerik:RadToolBar>
        </div>
        <div style="float:right;">
        Export: 
        <asp:Button ID="ExportToExcelButton" runat="server" CommandName="ExportToExcel" CssClass="rgExpXLS"/>
          
        <asp:Button ID="ExportToWordButton" runat="server" CommandName="ExportToWord" CssClass="rgExpDOC" />
          
        <asp:Button ID="ExportToPdfButton" runat="server" CommandName="ExportToPdf" CssClass="rgExpPDF" />
        </div>
        </div>
    </CommandItemTemplate>
    <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
...
0
Daniel
Telerik team
answered on 29 Sep 2011, 01:16 PM
Hello Scott,

I attached a simple demo that uses ObjectDataSource and which does not exhibit the described problem. Please examine it at your side and let me know if you find out the root cause of this behavior.

Thanks,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Scott Hannon
Top achievements
Rank 1
answered on 09 Dec 2011, 03:26 PM
Thanks for the sample, Daniel.

I tried putting a button on my form and implementing the export function, but this still doesn't work. My objectdatasource is backed by an xsd with SQL Server stored proc (with the paging and sorting parameters) as the source. I would prefer to bind the grid directly to the SQLDataSource because the export works correctly(all records), but then the count of records/paging doesn't work when I do this (it always says 0 items in 1 pages).
Maybe the grid rebinds when export is called and the parameters fed to the objectdatasource and therefore the stored proc, are empty, resulting in no data returned?

Update:
By searching for other RadGrid and Paging forum posts, I was able to make the direct SQLDataSource binding work correctly(turn off custom paging), therefore making the export also work correctly.
I still think there may be a problem when implementing the objectdatasource using xsd with SQL Server as the source.
0
Daniel
Telerik team
answered on 09 Dec 2011, 03:51 PM
Quote:
Maybe the grid rebinds when export is called and the parameters fed to the objectdatasource and therefore the stored proc, are empty, resulting in no data returned?

Indeed, RadGrid needs to rebind itself before exporting when the IgnorePaging property is set to true. This could be the reason for the aforementioned problem.

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Rory
Top achievements
Rank 1
answered on 07 Oct 2014, 04:15 PM
I am also having a problem with RadGrid and ObjectDataSource but I don't have the ability to unpack a .rar file at work, any chance of attaching a zip file or posting the example where I can see the source directly?  I'm having an issue where using CommandItemTemplate with ObjectDataSource is destroying my columns and data even though it is returning everything correctly.

Thanks,
Rory
0
Daniel
Telerik team
answered on 08 Oct 2014, 12:13 PM
Hello Rory,

I have reattached the example as Zip file. I hope this helps.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ahmed
Top achievements
Rank 1
answered on 23 Mar 2015, 12:48 PM
Unfortunately all the application's pages are using ObjectDataSource as a source for all grids, so how
to achieve the exporting all data using ObjectDataSource ?
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Scott Hannon
Top achievements
Rank 1
Rory
Top achievements
Rank 1
Ahmed
Top achievements
Rank 1
Share this question
or