Jul 14, 2016, 4:26 PM
[CLOSED] Close eventmask when file is downloaded using DirectEvent
Hey Team,
I have query related to DirectEvent and using eventmask along with DirectEvents.
My controller action is returning the file which is generated using another function GenerateFile method which is returning the file path.
View
Anyone knows how to close the eventmask after file is being downloaded?
I have query related to DirectEvent and using eventmask along with DirectEvents.
My controller action is returning the file which is generated using another function GenerateFile method which is returning the file path.
Public Function PdfDownload() As ActionResult
Dim genFilePath = GenerateFile(FileExtension.PDF, "templateFileName")
Dim fileBytes As Byte() = System.IO.File.ReadAllBytes(genFilePath)
Dim response = New FileContentResult(fileBytes, "application/octet-stream")
response.FileDownloadName = System.IO.Path.GetFileName(genFilePath)
Return response
End Function
View
@Html.X().Button().Text("Download").DirectEvents(Sub(ls)
ls.Click.EventMask.ShowMask = True
ls.Click.Url = Url.Action("BillingPdfDownload")
ls.Click.IsUpload = True
End Sub)
Issue is with EventMask, which never gets closed, because in this case result was never returned from action. Usually we put Me.Direct() and then eventmask gets to know that event is completed. But in our case I dont think we can put response anywhere inside Me.Direct() method as a result.Anyone knows how to close the eventmask after file is being downloaded?
Last edited by fabricio.murta; Jul 15, 2016 at 5:10 PM.