here I have done function but i want to visible buton (Button2) after download files . How is it posible? Plsase help me.
private void generatetable(string filename)
{
try
{
BaseFont bfTimes = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1257, false);
Font ChronicleFont = new Font(bfTimes, 1, Font.NORMAL);
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=" + filename + "");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
ftdiv.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4.Rotate(), 25, 25, 25, 25);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
MemoryStream memoryStream = new MemoryStream();
string folderpath = "SurveyReport/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
string directoryPath = Server.MapPath(string.Format(folderpath));
if (!Directory.Exists(directoryPath))
{
Directory.CreateDirectory(directoryPath);
PdfWriter.GetInstance(pdfDoc, new FileStream(Server.MapPath(folderpath) + filename, FileMode.Create));
}
else
{
PdfWriter.GetInstance(pdfDoc, new FileStream(Server.MapPath(folderpath) + filename, FileMode.Create));
}
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
//Response.Redirect(HttpContext.Current.Request.Url.PathAndQuery);
Response.End();
}
catch
{
//System.Threading.Thread.Sleep(6000);
Button2.Visible = true;
}
}