miroslav nikolic

miroslav nikolic

  • NA
  • 10
  • 5.2k

show javascript alert after send pdf file to client

Nov 27 2014 5:20 PM
I have Javascript in web form I want to send alert to client after send file but it is dosn't work .I can send pdf file but alert dosn't show I hope somone can help thanks in advance

<script type = "text/javascript">
function Confirm() {
alert("pdf document is send to you");
}
</script>

 code:
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Racun.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);

StringWriter stringWriter2 = new StringWriter();
HtmlTextWriter htmlTextWriter2 = new HtmlTextWriter(stringWriter2);
GridView1.RenderControl(htmlTextWriter2);

StringReader sr2 = new StringReader(stringWriter2.ToString());
Document doc2 = new Document(PageSize.A4, 10f, 10f, 10f, 00f);
HTMLWorker htmparser = new HTMLWorker(doc2);

PdfWriter.GetInstance(doc2, Response.OutputStream);
doc2.Open();
htmparser.Parse(sr2);
doc2.Close();

GridView1.DataBind();
Response.Write(doc2);
Response.End();
ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Confirm();", true);

Answers (2)