Reputation: 83
I am working on a web application where I want to show a loading image (busy indicator) when my code create a xml file and download it I want to show the image in a div. I should use c# code only not update panel nor the jquery ajax technique. My code looks like:
protected void lb_DownloadXML_Click(object sender, EventArgs e)
{
this.imgLoading.Visible = true;
//all my code
this.imgLoading.Visible = false;
}
my image is
<img src="Images/loading_big.gif" width="50" height="40" runat="server" id="imgLoading"
visible="false" />
but its not working. Can anybody explain me how can I achieve this task.
thanks in advance.
Upvotes: 0
Views: 3742
Reputation: 9680
To execute server side code from client machine, there is no other way other than UpdatePanel
or Ajax
. The client request should reach to the server to execute the request. And the way this happens is by PostBack or by Get request. PostBack
will reload page, if you are not using UpdatePanel
(I guess which you don't want) and second is GET, which again you don't want.
Update
According to @Lloyd
Yes it is possible, you can render contents to the page sequentially by setting the "Response.BufferOutput" property to false, writing directly to the Response.Output and Flushing the stream.
Upvotes: 1
Reputation: 4081
You should well understand that when you write any code on server side it is only reflected in the broswer after a successful postback. Over here if you write C# code to display an progress image then it would be displayed only after the postback is successful, that means after your XML file has been created and downloaded to the client end or after successful execution of lb_DownloadXML_Click().
So there is no way to achieve that using C# server side code, you have to rely on client side programming to achievev this.
Upvotes: 0