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

Grid Export on iPad iOS

10 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cliff Gibson
Top achievements
Rank 1
Cliff Gibson asked on 05 Dec 2012, 11:47 AM
I've got a form with a RadGrid which exports data to PDF and Excel.

On the web form both work without problem.  On Android the PDF works however the Excel file does not open - believes it is a CSV file and cannot open.

On an iPad neither will open - I just get a white blank window in place where the PDF should be and "Cannot open document" when trying to open Excel file.  Both android and iOS have Documents to Go installed.

has anybody got this working on iOS?

Cheers
Cliff

10 Answers, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 10 Dec 2012, 09:26 AM
Hello,

 Not all export types are supported on mobile devices. For excel export you should try the new BIFF export type that should work in all browsers and devices.
For PDF export the default iOS PDF reader does not support all versions of the PDF format that's why it shows blank white page. To view PDF files we recommend using a newer reader (for example latest version of Adobe Acrobat).

Greetings,
Marin
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
Cliff Gibson
Top achievements
Rank 1
answered on 10 Dec 2012, 09:53 AM
Hi Marin

Thanks for the reply, how come this is not on the demo site?  I can find no mention of it anywhere, I'll give it a go and report back.

Cheers
Cliff
0
Marin
Telerik team
answered on 11 Dec 2012, 08:46 AM
Hi,

 You can find a demo of the new export feature here:
http://demos.telerik.com/aspnet-ajax/grid/examples/export/biffexport/defaultcs.aspx

Regards,
Marin
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
Martin Roussel
Top achievements
Rank 1
answered on 21 Dec 2012, 04:04 PM
Marin,

I was testing RadGrid exporting on mobile devices lately and I have various issues, even when using Biff format.

On iPad (iOS 5.1.1) safari browser, when I have my grid into a RadSplitter/RadPane, the file opens in the RadPane (not in a separate tab). I dont have the option to save it somewhere neither...so cant use the export at all except viewing it. If I put the RadGrid directly on the page (outside the Splitter), it opens the file into the same browser tab. Any way to open it in a separate tab or ask the user what to do with the file?

On Android phone (Android 2.3.4) native browser, when I have my grid into a RadSplitter/RadPane, the export doesnt work. Nothing happens when clicking the Export to Excel icon. If I put the RadGrid directly on the page (outside the Splitter), it automatically download the file (but in .htm format). When I open the file, it contains alot of StructureColumns and not only the data itself.

here is the grid export setting definition:
   <ExportSettings OpenInNewWindow="true" HideStructureColumns="true" ExportOnlyData="true">
        <Excel Format="Biff"></Excel>
</ExportSettings>

Ill try to do more tests on different devices/browsers and report back here.

TIA

Martin
0
Daniel
Telerik team
answered on 26 Dec 2012, 05:41 PM
Hello Martin,

I do my best to reproduce these problems on my end, but in the meantime I would like to ask you try to temporarily disable (or comment out) all AJAX controls in this project. That said, our controls have a property named EnableAJAX which you could set to false.

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
Martin Roussel
Top achievements
Rank 1
answered on 27 Dec 2012, 03:23 PM
Daniel,

I tried looking for controls that support EnableAjax in my code and seems there isnt. Here's more code in order to help:

RadSplitter Page aspx:
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="Test3.aspx.cs" Inherits="PL.Test3" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
      
 
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
         
 
<telerik:RadSplitter ID="Radsplitter1" runat="server" Width="700" Height="300" Orientation="Horizontal">
    <telerik:RadPane ID="Radpane1" runat="server" Height="150">
        Left Pane
    </telerik:RadPane>
    <telerik:RadSplitBar ID="Radsplitbar1" runat="server" CollapseMode="Forward">
    </telerik:RadSplitBar>
    <telerik:RadPane ID="Radpane2" runat="server" Scrolling="None">
        <telerik:RadSplitter ID="Radsplitter2" runat="server">
            <telerik:RadPane ID="Radpane3" runat="server">
                Nested Splitter Top Pane
            </telerik:RadPane>
            <telerik:RadSplitBar ID="Radsplitbar2" runat="server" CollapseMode="Forward">
            </telerik:RadSplitBar>
            <telerik:RadPane ID="Radpane4" runat="server" ContentUrl="RadGridPage.aspx">
  
            </telerik:RadPane>
        </telerik:RadSplitter>
    </telerik:RadPane>
</telerik:RadSplitter><br />
 
 
    </form>
</body>
</html>

RadGridPage.aspx
<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="RadGridPage.aspx.cs" Inherits="PL.RadGridPage" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
 
                            <telerik:RadGrid ID="RadGrid1" runat="server" ClientSettings-EnableRowHoverStyle="true" PageSize="20" Width="99.9%"
                                AllowSorting="True" AllowFilteringByColumn="False"  AllowMultiRowSelection="false" AllowPaging="false"
                                ShowGroupPanel="false" GridLines="None" AutoGenerateColumns="False" ShowFooter="false" ShowHeader="false"
                                OnGroupsChanging="RadGrid1_OnGroupsChanging" OnColumnsReorder="RadGrid1_OnColumnsReorder" OnNeedDataSource="RadGrid1_NeedDataSource"
                                OnItemDataBound="RadGrid1_OnItemDataBound" Skin="WebBlue" EnableViewState="True" EnableHeaderContextAggregatesMenu="false" EnableHeaderContextMenu ="true">
               
 
                                    <MasterTableView CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="false"
                                    CommandItemSettings-ShowExportToExcelButton="true" CommandItemSettings-ShowExportToWordButton="true"
                                    CommandItemSettings-ShowExportToPdfButton="true" CommandItemSettings-ShowExportToCsvButton="true" AllowMultiColumnSorting="true"
                                    Caption="">
                                        <Columns>
                                            <telerik:GridTemplateColumn HeaderText="" UniqueName="strDetailsField" HeaderStyle-Width="25%" Resizable="true" Reorderable="true">
                                                <ItemTemplate>
                                                  <%# Eval("strDetailsField")%>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                            <telerik:GridTemplateColumn HeaderText="" UniqueName="strDetailsFieldValue" HeaderStyle-Width="75%" Resizable="true" Reorderable="true">
                                                <ItemTemplate>
                                                  <%# Eval("strDetailsFieldValue")%>
                                                  <asp:HyperLink ID="hlDetails" Target="_blank" runat="server" OnClick="CloseTooltip()" Text='<%# Eval("strDetailsLinkResource")%>' NavigateUrl='<%# Eval("strDetailsLinkValue")%>'></asp:HyperLink>
                                                </ItemTemplate>
                                            </telerik:GridTemplateColumn>
                                        </Columns>  
                                    </MasterTableView>
                         
 
                                    <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
 
                                    <ClientSettings AllowDragToGroup="true" AllowColumnsReorder="True" ReorderColumnsOnClient="True" ColumnsReorderMethod="Reorder">
                                        <Resizing AllowRowResize="False" EnableRealTimeResize="True" ResizeGridOnColumnResize="false" AllowColumnResize="true" AllowResizeToFit="true"/>
                                        <Animation AllowColumnReorderAnimation="false" AllowColumnRevertAnimation="true" />
                                        <Selecting AllowRowSelect="true"  />
                                    </ClientSettings>
 
                                    <GroupingSettings ShowUnGroupButton="true" />
 
                                    <ExportSettings OpenInNewWindow="true" HideStructureColumns="true" ExportOnlyData="true">
                                        <Excel Format="Biff"></Excel>
                                </ExportSettings>
 
                                </telerik:RadGrid>
 
               
    </form>
</body>
</html>

btw, I tried a iPhone with iOS 4.3.5 and experienced same behavior than iOS 5.1.1 previously reported.
0
Daniel
Telerik team
answered on 02 Jan 2013, 04:05 PM
Hello Martin,

Thank you for the clarification. I managed to reproduce the problems you mentioned. We are currently investigating the cause.
Will keep you posted.

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
Daniel
Telerik team
answered on 02 Jan 2013, 05:37 PM
Straight on the reported problems:

On iPad (iOS 5.1.1) safari browser, when I have my grid into a RadSplitter/RadPane, the file opens in the RadPane (not in a separate tab).
The problem is that the file is streamed to the response and you don't have an option to open it in a new tab. Instead, the built-in viewer displays the file directly within the iframe.
That said, as per my understanding the iPad users doesn't have direct access to the file system so saving the file is not an option.

On Android phone (Android 2.3.4) native browser, when I have my grid into a RadSplitter/RadPane, the export doesnt work. Nothing happens when clicking the Export to Excel icon.
This is likely a problem of the default browser which seems to have problems opening files in iframe even with the correct content type is specified. Our local tests indicate that this works properly for CSV format but only when the content-disposition header is set to inline (OpenInNewWindow=false).

If you wish, I could provide a simple demo that doesn't have any of our controls and which exhibits the aforementioned problems.

A possible workaround to both problems could be to manually save the file to the server's local filesystem and provide a direct link to it. This way you will be able to download the file (in Android) or open it in a new tab (in iOS).

Simplified code is shown below:
protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
  using (FileStream fs = File.Create(path))
  {
    Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
    fs.Write(info, 0, info.Length); 
  }
  Response.Redirect(Request.Url.ToString());
}

You can then set the URL pointing to the file to a server-side Hyperlink control and instruct the users to download the file by clicking on this link (hold your finger for download on Android).

Let me know if I'm missing something.

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
Martin Roussel
Top achievements
Rank 1
answered on 02 Jan 2013, 07:32 PM
Thanks Daniel for these clarifications.

Ill keep your external link workaround in memory but would prefer waiting for a fix for when the grid is directly on the page. I plan to build a separate mobile version of my site that is RadSplitter-free, since I experience too much issues with them on mobile devices (not just on grid export). I wanted to try if I could use one site only for non-mobile and mobile to reduce code development and maintenance but seems it will be hard to do so.

Martin
0
Daniel
Telerik team
answered on 03 Jan 2013, 12:33 PM
Hello Martin,

In my opinion it would be better to avoid all controls that use iframe as you might face different unexpected behaviors on mobile devices.
There are two simple workarounds for this case:
1) Instead of using complex desktop-like controls (RadSplitter), you can use simple links to navigate between pages.
2) You could put the contents of the desired page directly within the RadPane instead of using the ContentUrl which will force the control to use an iframe.

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.
Tags
Grid
Asked by
Cliff Gibson
Top achievements
Rank 1
Answers by
Marin
Telerik team
Cliff Gibson
Top achievements
Rank 1
Martin Roussel
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or