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

2 posts, 0 answers
  1. Indy
    Indy  avatar
    5 posts
    Member since:
    Nov 2012

    Posted 04 Jul 2017 Link to this post

    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

  2. Indy
    Indy  avatar
    5 posts
    Member since:
    Nov 2012

    Posted 11 Jul 2017 Link to this post

    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

     

Back to Top