N
Nathan Sokalski
I have a webform that contains a button which I want to do three things:
1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted
I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:
Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()
If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted
I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:
Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()
If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?