UI behavior

  • Thread starter Thread starter Arthur Yousif
  • Start date Start date
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 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
 
Back
Top