473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Postback after a Response.Writefile()

i have a treeview on a webform (.aspx). when the user selects an appropriate node on the tvw. and clicks on a link button, i'm downloading a corresponding file to the client (from the server). so far so good. all of that works.
after the download, i want to refresh the treeview and redisplay the current node with a different color. and also repopulate a property page on the right of the treeview

but my problem is that during the file download process, after a response.writefile() and a response.end() statement, the thread execution stops. even if the treeview refresh/navigate code executes first..lets say before the file download call, it does not show the changes visually on the page. like there was no postback.

***sample code**
private sub tvwMain_SelectedIndexChanged(sender, e) handles bla..
dim sFileName = tvwMain.GetNodeFromIndex(e.NewNode).ID
call RefreshTreeView 'reloads the tree and navigates back to the current nod

response.clear(
response.contenttype = ..
response.appendheader(...
response.writefile(sfilename
'response.flush()
response.end(
end su

i worked around this issue by using a javascript popup() window and having a download button in the popup.aspx, but i still couldnt close the popup automatically after a file download, using a window.close() or self.close() javascript, because the close() code wont execute correctly after a response.writefile

any suggestions on how it's done in the real "ASP.NET" world

thank
Carte

Nov 18 '05 #1
2 5680
I don't think there's a way to do this with plain code.

Possibly by using an IFrame and having the parent window monitor hte IFrame
and its download events/state, but that is really messy if it even would
work.

Is it really that important that the UI is updated? I mean standard protocol
for Web downlaods is to pop up a dialog and download asynchronously...
trying to emulate a Windows model in the browser doesn't always work <g>...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Carter" <an*******@discussions.microsoft.com> wrote in message
news:9C**********************************@microsof t.com...
i have a treeview on a webform (.aspx). when the user selects an appropriate node on the tvw. and clicks on a link button, i'm downloading a
corresponding file to the client (from the server). so far so good. all of
that works. after the download, i want to refresh the treeview and redisplay the current node with a different color. and also repopulate a property page on
the right of the treeview.
but my problem is that during the file download process, after a response.writefile() and a response.end() statement, the thread execution
stops. even if the treeview refresh/navigate code executes first..lets say
before the file download call, it does not show the changes visually on the
page. like there was no postback.
***sample code***
private sub tvwMain_SelectedIndexChanged(sender, e) handles bla...
dim sFileName = tvwMain.GetNodeFromIndex(e.NewNode).ID
call RefreshTreeView 'reloads the tree and navigates back to the current node
response.clear()
response.contenttype = ...
response.appendheader(...)
response.writefile(sfilename)
'response.flush()
response.end()
end sub

i worked around this issue by using a javascript popup() window and having a download button in the popup.aspx, but i still couldnt close the popup
automatically after a file download, using a window.close() or self.close()
javascript, because the close() code wont execute correctly after a
response.writefile.
any suggestions on how it's done in the real "ASP.NET" world?

thanks
Carter

Nov 18 '05 #2
yeah, it is important to refresh the tree after a filedownload.
and here's the reason why: a node in the tree view (and it's corresponding property page) represents a node from an object oriented CMS node(using COM interop). so...users select a node and check it out. i have code behind form to check the object out and saves it as an xml file on the server. (which is then downloaded to the client browser) i need to update the current node (and the content) to display visually that it's now checked out (or checkin,undo checkout etc

using a popup to download the file works, and it refreshes the main page (treeview) fine. if only i could close the popup page after the response.writefile(), that'd be great. i tried using a timer to kick off a download and it didnt work.
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jerry J | last post by:
I am using Response.WriteFile to send file streams back to web clients. My question is this: Can I use Response.WriteFile(SomeFilePath) for any size file? Will it handle chunking the data...
0
by: Xavier Osa | last post by:
Hi, I have an ASP.Net web page that you can download a file. As Fergunson's problem, it prompts twice dialog boxes only if I select Open button. If I select Save button, it prompts once. I'm...
2
by: David Union | last post by:
Hi. I'm posting this here because I don't know exactly what the best group is. This is for an aspx page with Visual Basic as the code-behind page. I am doing very simple code... in the middle...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
8
by: Scott C. Reynolds | last post by:
I want to serve a PDF right to a web page (cannot link browser directly to PDF file). Stumbled across Response.WriteFile this morning. On my machine (XP Pro) this worked fine: private void...
4
by: david | last post by:
I has a question: I can use Response.WriteFile to display images such as .jpg. But I can not us it to display words doc file in EI by calling Response.WriteFile("testdoc/DownloadLarge.doc"). It...
4
by: DEWright_CA | last post by:
I need to be able to from C# launch a postback. I have a command button that launches a function, I also have a javascript function that then keeps you from firing any other objects on the page,...
1
by: SQwilDude | last post by:
My ASP2.0 application has always run fine in IE6 and FF. Only on IE7 installations I get a 'document.form1' is null error after a postback that creates an .m3u file on the server and does a...
3
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.