472,791 Members | 1,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,791 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 5590
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.