You must Sign In to post a response.
  • Category: ASP.NET

    When open excel i want to show popup

    I am exproting the gridview data to excel.

    it is downloading directly.

    i want to show the popup before downloading.

    My code as follows

    Response.Buffer = true;
    Response.Charset = "";
    string FileName = "Employeess.xls";
    StringWriter strwritter = new StringWriter();
    HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
    Response.ContentType = "application/";
    Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
    gvEmpdetails.GridLines = GridLines.Both;
    gvEmpdetails.HeaderStyle.Font.Bold = true;

    in my above code when i export the gridview to excel. gridview data is exproting into excel.

    but before exproting into excel i want to show popup as follows

    Yes No Cancel

    for that how can i do in using C#.
  • #765816
    download a file and open file is a client browser application, does not have any control on it, when browser prompt for download it has 3 button
    1. save
    2. Open
    3. cancel
    here if you click on open, the browser will open a file in temp folder and remove it when you close file, when you click on save it will save it in specified location
    I don't think there is a way to open a file after download

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765833

    I never tried this combination but I tried it separately, use modalpopupextender control in AJAX to achieve the confirmation with Yes / No option.
    You have to do more customization to achieve this task, while click save you need to perform the saving the file into temporary location same like for open you need to perform opening the file for one instance.

    please use below link to show the confirmation before perform any action.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • Sign In to post your comments