UI behavior

A

Arthur Yousif

Hi,

I have a situation and I cannot figure out why it's not working. I have a
page (page1.aspx) with a LinkButton that calls another page (page2.aspx) to
download a report in pdf format.

In page1.aspx.cs, I trap for lnkSavePdf_Click(...) and when it's called, I
then call page2.aspx by using
Response.Recdirect(sUrl,false). I use false to keep the code moving. All
this works fine except for the following.

I have a Literal control on the page that I'd like to update with text like
"Downloading PDF, please wait..." but it never updates. I've tried putting
the pdfInfo.Text = "Downloading PDF, please wait..." in multiple places but
the page never shows it. I've run in debug mode and those lines are hit.
Any ideas what's going on and why it's not working? I'm pretty sure it's my
lack of knowledge on some of this, so any wisdom from you would greatly
appreciated.

Arthur
 
A

Alvin Bruney

A redirect is not guaranteed to occur on the same thread. It is treated as a
new request from the browser. That is why you aren't seeing your 'splash
screen' because the session has already closed and a brand new one has
started.

A splash screen is not trivial to implement. I've provided code in
framework.aspnet user group that implements this using separate threads but
even so it is a challenge. But here is another quick and clean way to get
the effect you want. Use attributes on your click event to show a client
side gif or whatever you have.
clickbutton.attributes.add("onclick","document.all.mygifimage.display.style=
'';"); when the button to download the pdf is clicked, it immediately shows
this gif to the screen. Using javascript, call
document.all.mygifimage.display.style='none' in the onload function of the
form tag. This will make the image disappear once the page has loaded.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top