Click here to Skip to main content
15,917,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am still suffering from this problem where my progress image is not getting hide after the download box appears on the screen. I am making use of update panel and update progress. Do I need to make my update panel a post back to hide the image ? Doing so will cause download box disappear ??? I am not sure . Please help me guys.

Here is my HTML mark up of the update panel and update progress.:
<pre lang="HTML">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <asp:Button ID="btnDownload" runat="server" CssClass="Admin_Button" OnClick="btnDownload_Click"
                                        Text="Download" Width="91px" UseSubmitBehavior="False" />
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <asp:UpdateProgress ID="updProgress" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
                                <ProgressTemplate>
                                    <img alt="progress" src="images/indicator.gif" height="30px" width="30px" />
                                    Processing...
                                </ProgressTemplate>
                            </asp:UpdateProgress>


C#
protected void btnDownload_Click(object sender, EventArgs e)
   {
 lblMsg.Visible = false;
                     lbl_date_error.Visible = false;
                     strHSCODE = Convert.ToString(ViewState["strHSCODE"]);
                     strDataType = Convert.ToString(ViewState["strDataType"]);
                     strCombination = Convert.ToString(ViewState["strCombination"]);
                     strProd = Convert.ToString(ViewState["strProd"]);
                     strProd_not = Convert.ToString(ViewState["strProd_not"]);

                     DataTable iResult = bl_my_account_client.Query_Data(strDataType, date_from_by_user, date_to_by_user, strHSCODE, strCombination, strProd, strProd_not);


                     if (iResult.Rows.Count != 0)
                     {
                         HttpContext.Current.ApplicationInstance.CompleteRequest();
                         this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "JScript1", "hideImage();", true);

                        
                         Session["Download"] = iResult;
                         Response.Redirect("Download.aspx");
                         

                     }
                     else
                     {
                         lbl_date_error.Visible = true;
                         lbl_date_error.Text = "Error: This request cannot be processed ...";
                     }
}

I am downloading a csv file frfom database

Do i need to make use of javascript in order to hide that spining image after my process completes ???
Posted
Updated 27-Jun-12 18:28pm
v2
Comments
Taresh Uppal 27-Jun-12 5:58am    
Help me please !
Sandeep Mewara 27-Jun-12 7:39am    
Share what is your btnDownload_Click button event do. Not clear by 'download box' here. Update progress is suppose to be there as long as the UpdatePanel partial update to view is not complete.
Taresh Uppal 27-Jun-12 8:40am    
protected void btnDownload_Click(object sender, EventArgs e)
{
lblMsg.Visible = false;
lbl_date_error.Visible = false;
strHSCODE = Convert.ToString(ViewState["strHSCODE"]);
strDataType = Convert.ToString(ViewState["strDataType"]);
strCombination = Convert.ToString(ViewState["strCombination"]);
strProd = Convert.ToString(ViewState["strProd"]);
strProd_not = Convert.ToString(ViewState["strProd_not"]);

DataTable iResult = bl_my_account_client.Query_Data(strDataType, date_from_by_user, date_to_by_user, strHSCODE, strCombination, strProd, strProd_not);


if (iResult.Rows.Count != 0)
{
HttpContext.Current.ApplicationInstance.CompleteRequest();
this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "JScript1", "hideImage();", true);


Session["Download"] = iResult;
Response.Redirect("Download.aspx");


}
else
{
lbl_date_error.Visible = true;
lbl_date_error.Text = "Error: This request cannot be processed ...";
}
}
I am downloading a csv file frfom database
Taresh Uppal 27-Jun-12 8:48am    
the download box is the open-save-cancel download dialogue box that usually comes on our window when we download something. The starnge thing is that even I am redirecting to a different page and on that page all the download box creation code is written incuding that content-disposition etc etc.
Still I get the download box on this page only and doesnt redircts me anywhere and that image stays there even after download process completes. This is all my issue.

1 solution

Hi...
Well somehow I managed to solve it myself by using following links:

VB
http://www.etechplanet.com/blog/downloading-file-using-aspnet-and-c.aspx
http://www.etechplanet.com/blog/downloading-file-using-aspnet-and-c.aspx


So anyways thanx who thot to give a try for me.
Thanx guyz
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900