This is a migrated thread and some comments may be shown as answers.

Image not show up in the last postback

1 Answer 30 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Raymond Mui
Top achievements
Rank 1
Raymond Mui asked on 05 Sep 2008, 09:07 AM

First of all, I believe that it is not a RadControls problem, but a general AJAX case.  I have a webpage that generates an Excel file on the server, and the page uses AJAX to update the status (as it is a long process).  

The following is the (partial) codes that I use:

     Me.imgStatus.ImageUrl = "~/Images/tick.jpg"
     Me.imgStatus.AlternateText = "Done"
     Me.RadAjaxManager1.ResponseScripts.Add("window.location.href='DownloadFile.aspx';")

"Downloadfile.aspx" is another file that prompts the user to Open or Save the Excel (instead of displaying on within IE).  The following is the code-behind in Downloadfile.aspx.vb:

  Response.Clear()
  Response.ContentType = "application/x-msdownload"
  Response.AddHeader("content-disposition", "attachment;filename=WAT_ASWSalesWithGPByBrandCustomer_" & Format(Now(), "yyyyMMdd") & ".xls")
  excelFile.SaveXls(Response.OutputStream)


Now, my problem: the image "imgStatus" sometimes does not show up, and there is no Red cross on the web page.  When I right-click the location of  "imgStatus", and select "Show picture", the "Tick.jpg" loaded.

I think it is "Response.Clear()" that prohibits the displaying of "imgStatus".  To ensure that "imgStatus", i.e. the tick.jpg, shows, should I add one more post-back (thus delay the page redirection).  Is there anyway to overcome this?


1 Answer, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 08 Sep 2008, 02:09 PM
Hi Raymond Mui,

I am not sure whether I understand the issue correctly, but I suggest you to try buffer the response before flush it to client. You can try using the following lines
Response.Clear()  
Response.Buffer = true 
Response.ContentType = "application/x-msdownload" 
//your other code here

Other option you have is if you are exporting RadGrid control there is property 
<RadGrid Name>.ExportSettings.OpenInNewWindow. If it set to true it new popup window will be open to save/open exported document.

I hope you will find provided information helpful. 


Best wishes,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Raymond Mui
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Share this question
or