I have a grid and when I try to export the data to Excel, CSV or Word it wants to open the entire html page. This happens only when I choose the "Open" option - it works fine if I click "Save" or "Save as". It also works fine with Firefox if I "Open" the spreadsheet.
In IE9 when I click on any of the buttons and select "Open" I get the message: "RadGrid.xls can't be downloaded". If I click on "Retry" and there isa temporary message saying "running security scan". Then it opens Excel and a dialog box comes up with this message:
The file you are trying to open, 'RadGridExport.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now.
I take the option and say 'Yes' and it basically loads the entire aspx page into Excel.
The site is not SSL. (Some comments in the forum had solutions for when the site was SSL).
The grid is hierarchical with grouping. But it still does not work when I remove the grouping and I collapse all the nested data. In the code I have removed the NeedDataSource as they work fine to generate the table and I doubt they are the issue (if I'm wrong, I can post this too.) I also removed a tabstrip and some additional controls that allow me to filter the data source. (Again I will post if needed.)
Any help is appreciated.
Here is the code:
In IE9 when I click on any of the buttons and select "Open" I get the message: "RadGrid.xls can't be downloaded". If I click on "Retry" and there isa temporary message saying "running security scan". Then it opens Excel and a dialog box comes up with this message:
The file you are trying to open, 'RadGridExport.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now.
I take the option and say 'Yes' and it basically loads the entire aspx page into Excel.
The site is not SSL. (Some comments in the forum had solutions for when the site was SSL).
The grid is hierarchical with grouping. But it still does not work when I remove the grouping and I collapse all the nested data. In the code I have removed the NeedDataSource as they work fine to generate the table and I doubt they are the issue (if I'm wrong, I can post this too.) I also removed a tabstrip and some additional controls that allow me to filter the data source. (Again I will post if needed.)
Any help is appreciated.
Here is the code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)If Not IsPostBack Then RadAjaxManager.GetCurrent(Me.Page).ClientEvents.OnRequestStart = "onRequestStart"End ifEnd Sub
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" > <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </telerik:RadAjaxManagerProxy> <telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" AutoGenerateColumns="false" Width="1000" GridLines="Both" Skin="Sunset" ShowGroupPanel="true" AllowFilteringByColumn="False" AllowPaging="True" AllowSorting="True" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" Height="500px" OnNeedDataSource="RadGrid1_NeedDataSource"> <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" HideStructureColumns="true"> </ExportSettings> <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" AllowGroupExpandCollapse="True" ReorderColumnsOnClient="True" AllowDragToGroup="True"> <Scrolling AllowScroll="True" UseStaticHeaders="True" /> <Resizing AllowColumnResize="true" AllowRowResize="true" /> </ClientSettings> <MasterTableView DataKeyNames="ClientAlertID" CommandItemDisplay="Top"> <CommandItemSettings ShowExportToWordButton="true" ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowAddNewRecordButton=false /> <DetailTables> <telerik:GridTableView Name="Events" Width="100%" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" HierarchyDefaultExpanded="true" > <HeaderStyle CssClass="InnerHeaderStyle" /> <ItemStyle CssClass="InnerItemStyle" /> <AlternatingItemStyle CssClass="InnerAlernatingItemStyle" /> <FilterItemStyle CssClass="InnerHeaderStyle" /> <PagerStyle CssClass="InnerHeaderStyle" /> <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="OpenDate" ItemStyle-Width=135 HeaderStyle-Width="135" FilterControlWidth="100" FilterControlAltText="Filter OpenDate column" HeaderText="Open Date" ReadOnly="True" SortExpression="OpenDate" UniqueName="OpenDate" /> <telerik:GridBoundColumn DataField="device_vendor" ItemStyle-Width=75 HeaderStyle-Width="75" FilterControlWidth="45" FilterControlAltText="Filter device_vendor column" HeaderText="Device Vendor" ReadOnly="True" SortExpression="device_vendor" UniqueName="device_vendor" /> <telerik:GridBoundColumn DataField="device_type" ItemStyle-Width="75" HeaderStyle-Width="75" FilterControlWidth="45" FilterControlAltText="Filter device_type column" HeaderText="Device Type" ReadOnly="True" SortExpression="device_type" UniqueName="device_type" /> <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter Description column" HeaderText="Description" ReadOnly="True" SortExpression="Description" UniqueName="Description" /> <telerik:GridBoundColumn DataField="event_name" ItemStyle-Width="75" HeaderStyle-Width="75" FilterControlWidth="45" FilterControlAltText="Filter event_name column" HeaderText="Correlation Rule" ReadOnly="True" SortExpression="event_name" UniqueName="event_name" /> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> <HeaderStyle BackColor="Brown"></HeaderStyle> </telerik:GridTableView> </DetailTables> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <GroupByExpressions> <telerik:GridGroupByExpression> <SelectFields> <telerik:GridGroupByField FieldAlias="AlertType" FieldName="AlertType"></telerik:GridGroupByField> </SelectFields> <GroupByFields> <telerik:GridGroupByField FieldName="AlertType"></telerik:GridGroupByField> </GroupByFields> </telerik:GridGroupByExpression> </GroupByExpressions> <Columns> <telerik:GridBoundColumn DataField="ClientAlertID" ItemStyle-Width=50 HeaderStyle-Width="50" FilterControlAltText="Filter ClientAlertID column" HeaderText="Alert ID" ReadOnly="True" AllowFiltering="false" SortExpression="ClientAlertID" UniqueName="ClientAlertID" /> <telerik:GridBoundColumn DataField="AlertType" ItemStyle-Width=150 FilterControlWidth="120" HeaderStyle-Width="150" FilterControlAltText="Filter AlertType column" HeaderText="Alert Type" ReadOnly="True" AllowFiltering="false" SortExpression="AlertType" UniqueName="AlertType" /> <telerik:GridBoundColumn DataField="Priority" ItemStyle-Width=75 FilterControlWidth="45" HeaderStyle-Width="75" FilterControlAltText="Filter Priority column" HeaderText="Priority" ReadOnly="True" AllowFiltering="false" SortExpression="Priority" UniqueName="Priority" /> <telerik:GridBoundColumn DataField="CreationTime" ItemStyle-Width=135 FilterControlWidth="100" HeaderStyle-Width="135" FilterControlAltText="Filter CreationTime column" HeaderText="Creation Time" ReadOnly="True" AllowFiltering="false" SortExpression="CreationTime" UniqueName="CreationTime" /> <telerik:GridBoundColumn DataField="Dest" FilterControlAltText="Filter Dest column" HeaderText="Dest IP" ReadOnly="True" AllowFiltering="false" SortExpression="Dest" UniqueName="Dest" /> <telerik:GridBoundColumn DataField="Source" FilterControlAltText="Filter Source column" HeaderText="Source IP" ReadOnly="True" AllowFiltering="false" SortExpression="Source" UniqueName="Source" /> <telerik:GridBoundColumn DataField="EventName" FilterControlAltText="Filter EventName column" HeaderText="Event Name" ReadOnly="True" AllowFiltering="false" SortExpression="EventName" UniqueName="EventName" /> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> </MasterTableView> <GroupingSettings ShowUnGroupButton="true" /> <FilterMenu EnableImageSprites="False"></FilterMenu> </telerik:RadGrid> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" InitialDelayTime="500" > </telerik:RadAjaxLoadingPanel> <script type="text/javascript"> function onRequestStart(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); } }</script></asp:Content>