By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,301 Members | 3,575 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,301 IT Pros & Developers. It's quick & easy.

Postback after a Response.Writefile()

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.