Showing posts with label response. Show all posts
Showing posts with label response. Show all posts

Monday, March 26, 2012

UpdatePanel + Scriptmanger and Respone.Redirect to (external time consuming ressource)

Hello,

As the title of my post suggest, i use Response.Redirect(http://..../download.ahsx) on submit of my form;

This works fine. The file is streamed to the users browser and my update panel displays the " loading data gif".

The problem is that when the external page returns, we are not notified of this and we keep displaying the "loading data gif".

Is there a client side event i should process to refresh the starting page?

Thanks

/kadji

Is Ajax of any help in such of situation at all?

Thanks

/Kadji


Hi,

I'm afraid AJAX cann't do this.

As you said, when the external page returns, the starting page is not notified keep displaying the "loading data gif".

I suggest you use a timer to hide the "loading data gif" manually.

Best Regards


You are correct.

Thanks

/Kadji


But then what would i be looking for in my timer tick?

My web application still has no idea of what is happening in my remote resource.

Any suggestion?

/Kadji


Sorry,I mean javascript timer,not AJAX timer.

More information,seehttp://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/

Best Regards


Hi Jin-Yu Yin,

Could you explain how a client side timer would let me know that my http handler has finished running?

Thanks

/Kadji

Wednesday, March 21, 2012

UpdatePanel and Response.Write / Response.TransmitFile

I think I may be missing something obvious here, there are many posts about not using Response.Write to write to the page within an UpdatePanel. But how can I generate and transmit a file to the client while inside an UpdatePanel?

For example, a page might be laid out like this:

<Updatepanel>
<Selection Controls>
<Button>
<Table/>
</UpdatePanel>

The purpose of the Button is to allow the client to simply export the data from the table:

Protected Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button.Click
CreateMyFile()
Response.Clear()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment; filename=HelloWorld.txt")
Response.TransmitFile("HelloWorld.txt")
Response.End()
End Sub

Obviously I can move the Button triggering the download outside the UpdatePanel and use one UpdatePanel for the Selection Controls and another for the Table, but is there a better way to accomplish what I'm trying to do that I'm overlooking?

Thanks,

Hi.

you can use this code in page_load.

 ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(Button);