下载文件后我必须执行更多代码,但它没有发生。编译器命中ClearControls();
after DownloadFile();
,但该函数未执行。在页面上,我收到打开或保存文件的提示。但是文本框没有被清除。在这种情况下应该怎么做。
protected void btnOk_Click(object sender, EventArgs e)
{
//ClearControls(); // not working here too.
DownloadFile();
ClearControls();
}
private void DownloadFile()
{
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition","attachment;filename="+sName+".pdf");
Response.TransmitFile(Server.MapPath("~/documents/ready/" + strPdfName));
//Response.End();
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
private void ClearControls()
{
txtOne.Text="";
txtTwo.Text="";
}