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

Grid Excel Export works in visual studio debug mode but not normally

1 Answer 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Indy
Top achievements
Rank 1
Indy asked on 04 Jul 2017, 04:07 PM

Hi
I have an an asp.net radgrid using webforms.  The Excel export seems to work in debug mode when in visual studio but faisl when in environment.  If I debug I can see the items being hit via debug/watch window and all works well.  Any idea why it does not work when not in debug mode.  Please see below sample code:

 

<ClientSettings ReorderColumnsOnClient="False" AllowDragToGroup="False" AllowColumnsReorder="False">
<Selecting AllowRowSelect="True" />
 </ClientSettings>
<ExportSettings IgnorePaging="true" OpenInNewWindow="true" ExportOnlyData="true" >
<Excel Format="ExcelML" AutoFitImages="true" />
<Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageBottomMargin="5mm" PageTopMargin="5mm" PageLeftMargin="5mm" PageRightMargin="5mm" />
</ExportSettings>


With GridView1
.ExportSettings.FileName = "ProjectTrackerAt" & Now().ToString("dd-MMM-yy")
.ExportSettings.IgnorePaging = True
.ExportSettings.OpenInNewWindow = True
.HeaderStyle.Font.Bold = True
.ExportSettings.Excel.Format = GridExcelExportFormat.Html
.MasterTableView.ExportToExcel()
End With

1 Answer, 1 is accepted

Sort by
0
Indy
Top achievements
Rank 1
answered on 11 Jul 2017, 10:41 AM

I finally managed to work this out - it was because my page was not identified in the URL eg my URL was:

http://localhost/WebSiteName/SubDirectory/

The above goes to default.aspx

However if the raw url is http://localhost/WebSiteName/SubDirectory/default.aspx then the Export works fine

 

Tags
Grid
Asked by
Indy
Top achievements
Rank 1
Answers by
Indy
Top achievements
Rank 1
Share this question
or