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

Export to ExelML not working

6 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roland
Top achievements
Rank 1
Roland asked on 24 Feb 2009, 12:33 PM
Hi!

I tried to export my grid to an excel file, but the dialog if i want to save or open the file is not shown.

Ajax Setting of RadGrid

 <telerik:AjaxSetting AjaxControlID="SummaryGrid"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="SummaryGrid"/> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 

Grid Declaration

<telerik:RadGrid ID = "SummaryGrid" runat="server" AllowSorting="true" AutoGenerateColumns="false" OnExcelMLExportRowCreated="ExportRowCreated" 
                                         Width="900px" Height="280" GridLines="none" OnNeedDataSource="SummaryGridNeedsData" Skin="Telerik"
                            <MasterTableView GroupLoadMode="Client"
                            <Columns> 
                                <!-- 5 GridGoundColumns !--> 
                        </Columns> 
                        <NoRecordsTemplate> 
                            <div>There are no articles to Display</div> 
                        </NoRecordsTemplate> 
                   </MasterTableView> 
                   <ClientSettings AllowGroupExpandCollapse="true" ReorderColumnsOnClient="true" AllowColumnsReorder="true" AllowDragToGroup="true"
                    <Scrolling AllowScroll="True"  UseStaticHeaders="true"  /> 
                   </ClientSettings> 
                 </telerik:RadGrid> 

Button Click Event where Export should happen

SummaryGrid.ExportSettings.FileName = "Test.xls"
SummaryGrid.ExportSettings.ExportOnlyData = true
SummaryGrid.ExportSettings.OpenInNewWindow = true
SummaryGrid.ExportSettings.IgnorePaging = true
SummaryGrid.ExportSettings.Excel.Format = 
Telerik.Web.UI.GridExcelExportFormat.ExcelML; 
 
SummaryGrid.MasterTableView.ExportToExcel(); 

I tried to catch the OnExcelMLExportRow Created Event but the debugger never falls in the event handler.

Can you please help me to solve this issue?

Regards,
Martin






6 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Feb 2009, 01:41 PM
Hello Martin,

I tried to reproduce the problem but unfortunately to no avail. Please find my test project (based on your code) attached to this post. Let me know whether it behaves as expected on your end.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roland
Top achievements
Rank 1
answered on 24 Feb 2009, 01:55 PM
Hi Daniel!

Thanks for your quick response.

It works as expected, what could be possible errors on my working solution, that it doesn't work?

Regards,
Martin
0
Daniel
Telerik team
answered on 24 Feb 2009, 02:20 PM
Hello Martin,

If you are binding RadGrid to collection of custom object you should set UseAllDataFields="true" to the MasterTableView.

<MasterTableView UseAllDataFields="true" ... 

Hope this is your case.

Best regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roland
Top achievements
Rank 1
answered on 25 Feb 2009, 06:20 AM
Hi Daniel!

i tried your suggestion, but unfurtunately without sucess, the grid gets reloaded, but the save/open file dialog is not shown at all.

This is the changed Markup of the Grid

<telerik:RadGrid ID = "SummaryGrid" runat="server" AllowSorting="true" AutoGenerateColumns="false" 
                                         Width="900px" Height="280" GridLines="none" OnNeedDataSource="SummaryGridNeedsData" Skin="Telerik"
                            <MasterTableView GroupLoadMode="Client" UseAllDataFields="true"

Are there any other possibilites which could have cause this problem?

Regards,
Martin
0
Accepted
Daniel
Telerik team
answered on 25 Feb 2009, 07:11 AM
Hello Martin,

I suppose you are not exporting with AJAX enabled?
Export from ajaxified grid

You can send us a simplified working version of your project illustrating the aforementioned issue.

Thank you for your cooperation.

Kind regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roland
Top achievements
Rank 1
answered on 25 Feb 2009, 08:45 AM
Hi Daniel!

Thanks for your great support. I have now solved the problem. The cause of the misfunctionionality was that i have not directly ajaxified the grid, i have the grid inside a multipage with several page views, controlled by a TabStrip. So the problem was the the grid and the button were ajaxified through the multipage control.

I now solved the problem be manuelly adding an asp UpdatePanel around the Export Button, an add the JavaScript for Exporting on Ajaxified Grids in the page.

<asp:UpdatePanel ID="ExportPanel" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"
                                <ContentTemplate> 
                                    <asp:Button ID="btnExportConfiguration" Text="Export Configuration" runat="server" OnClick="ButtonClick" /> 
                                </ContentTemplate> 
                                    <Triggers> 
                                        <asp:PostBackTrigger ControlID="btnExportConfiguration" /> 
                                    </Triggers> 
                                </asp:UpdatePanel>   

The code above shows the modification of the page, maybe someone else can need it.

Regards,
Martin
Tags
Grid
Asked by
Roland
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Roland
Top achievements
Rank 1
Share this question
or