Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
UltraWebGridExcelExporter Not Showing Save Dialog
posted

What I'm doing here is using code to determine if there are 300 rows in my dataset.  If there are, then I want to create the new WebGrid object and use that for the Excel export.  If there are not 300, then I use the grid that is visible on the page.  I'm doing this for performance reasons because the users can have grids with hundres, and thousands of rows which take quite a while to render on the page.  When there are 300 rows, the save dialog box never comes up.  Please help!

<igtblexp:UltraWebGridExcelExporter ID="gridExport" runat="server" DownloadName="Results.XLS">
</igtblexp:UltraWebGridExcelExporter>

protected void SaveExcel(UltraWebGrid grid)
{
    
UltraWebGrid ug = new UltraWebGrid();
    
if (Session["reportGrid"] != null)
     {
         
if (((DataSet)Session["reportGrid"]).Tables[0].Rows.Count > 300)
          {
               ug.DataSource = (
DataSet)Session["reportGrid"];
               ug.DataBind();
               gridExport.Export(ug);
          }
     }
    
else
    
{
          gridExport.Export(grid);
     }
}

Parents
No Data
Reply
  • 28464
    posted

     I think for that to work, the grid should be part of the page control tree (e.g. exist on the page) and have valid ID. Could you please try the following - add a dummy placeholder on the page, e.g.

    <asp:placeholder runat="server" ID="Placeholder1" ... />

    and then prior

    to exporting the fake grid, add it to the control collection of the placeholder, for example:

    UltraWebGrid ug = new UltraWebGrid();

    ug.ID = "ExportToExcelGrid";

    Placeholder1.Controls.Add(ug)

    Also, a good idea would be to place a break point on the first line of the SaveExcel method - this may produce additional clues.

Children