I am calling .ashx file for download excel file from Master page menu item. But here confusion for user. user doesn’t know whether download happening or not.
How can put a progress bar popup when menu item clicked in masterpage and auto disappear after download?
MasterPage.Master
if e.Item.Text = "Download" Then
Dim strUrl As String = "../Users/Download.ashx"
ResponseHelper.Redirect(strUrl, "_black", "resizable=no, scrollbars=no")
end if
Download.ashx
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
'Some logic
Dim filename As String = "FullExtract_" & Now.Year.ToString & Now.Month.ToString & Now.Day.ToString & ".xlsx"
context.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
context.Response.AddHeader("content-disposition", "attachment; filename=" & filename)
context.Response.BinaryWrite(pck.GetAsByteArray())
context.Response.End()
End Sub
If it wouldn’t interfere with any existing restrictions, you could use jQuery’s .ajax() function in your page to make the ajax call and handle the client notification as part of that call (rough example):