0
I have an aspx page with a grid and a linkbutton. When clicking on this linkbutton I call a function that hangs the screen and places a loading while downloading a file on the server, after the download I try to call the function to unlock the screen, but it does not call because the Answer has already been completed. tried to perform via iframe but don’t know how to send that same file to be downloaded in iframe.
follow my codes.
When I click on the grid linkbutton
Script code
$('#meugrid').find('a').click(function () { ForceBlock(); });
Linkbutton code in codebehind
protected void linkbtn_Click(object sender, EventArgs e)
{
LinkButton lb = (LinkButton)sender;
int id = Convert.ToInt32(lb.CommandArgument);
FileInfo arquivo = new FileInfo("meuarquivo");
string path = @"meucaminho\";
File.WriteAllBytes(path + arquivo.FileName, arquivo);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment; filename=" + arquivo.FileName);
Response.AddHeader("Content-Length", arquivo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.TransmitFile(path + arquivo.FileName);
Response.Flush();
Response.Close();
HttpContext.Current.ApplicationInstance.CompleteRequest();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "scriptUnblock", "ForceUnblock()", true);
}
Any error in console?
– Leandro Angelo
no, no mistake...
– Guilherme Camarotto