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

Export to Excel exporting multiple times

5 Answers 495 Views
Grid
This is a migrated thread and some comments may be shown as answers.
varun
Top achievements
Rank 1
varun asked on 11 Aug 2009, 07:08 PM
Hi,
I am presently using the Q! 2009 version of the Rad controls.
I have used the export to excel feature in my screen throught a link button on my screen.
when i export the file on button click the following set of actions are seen on the client side.

A standard IE file download pop up appears which asks whether file should be opened or saved.
      If i say save it works fine.

  If I say Open it gives the standard Microsoft Office Excel 2003 warning(Which is fine) saying the file you are trying to open, Default.aspx(Which is my page name and not the filename as specified in the previous pop up or my code) you are trying to open 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?  


If i say yes it opens in excel with default.aspx.
 If I say no again I get another excel 2003 warning saying you are trying to open <The_Actual_File_Name>, 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?
If I say yes it opens the file but if I say no again I once again get a File download warning with the options of Save and cancel.

What I want the Export to Excel to do is present the option of open /save once as before and on clicking open It should open the file in Excel 2003(Even if it gives the excel warning its fine as long as it is only once with the right name)

How can we go about this?

Attached below is my VB code for reference.

Protected Sub lnkExport_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkExport.Click
         If Not ddlDataCut.SelectedValue = "" Then
            grid.ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.ExcelML
            grid.ExportSettings.IgnorePaging = True
            grid.ExportSettings.ExportOnlyData = True
            grid.ExportSettings.FileName = ddlDataCut.SelectedItem.Text.Substring(0, ddlDataCut.SelectedItem.Text.LastIndexOf(".")) 'Gets the filename from dropdown
            grid.MasterTableView.ExportToExcel
        End If
    End Sub



And this is my ASP code for the control i use

<asp:LinkButton ID="lnkExport" runat="server" Text="Export to Excel File (.Xls)"></asp:LinkButton>



5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 12 Aug 2009, 02:57 PM
Hello Varun,

Please try this demo and if everything works for you as expected, you should be able to imitate the settings in it to get your code working.

Kind regards,
Pavlina
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
varun
Top achievements
Rank 1
answered on 12 Aug 2009, 07:02 PM
Hi Pavlina,
Even the Telerik Demo is giving the same results in my development environment.
Does Telerik need any IE security settings to be reduced(or Excel security settings to be reduced) to function normally?

Thanks in advance
Varun.
0
Pavlina
Telerik team
answered on 13 Aug 2009, 02:34 PM
Hello Varun,

I think it is not needed any IE security settings in order Export to function normally.
Could you please try to set OpenInNewWindow property to true and see if it makes any difference?
Also try to run the project under different browser and let me know what is the result.

Regards,
Pavlina
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
varun
Top achievements
Rank 1
answered on 14 Aug 2009, 04:43 AM
Thanks Pavlina,
That did the trick.
One more thing.I noticed that when filtering is enabled on the grid the export to excel feature exports the filtered items.Is there a way to export all the items in the grid without clearing the filters in the grid?

Regards,
Varun
0
Pavlina
Telerik team
answered on 14 Aug 2009, 10:47 AM
Hello Varun,

If you are using the built in filtering feature of the Grid you just need to click the Export button before performing the filtering operation in order to export all items. In case you export after filtering then only filtered items would be exported.

Regards,
Pavlina
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.
Tags
Grid
Asked by
varun
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
varun
Top achievements
Rank 1
Share this question
or