How to refresh the calling content webpage

S

srid

Hi,

I have a contentpage1 inside the master page. The contentpage1 has two
textboxes to enter startdate and enddate.; a button1 to create a excel file.

when user clicks on the button1,

1)I am showing a "Please wait" messsage in a label1(by making visible using
javascript).

2)then creating the excel file(server side code)

3)once the file is created(after 2-3 minutes), i want to hide the "Please
wait" message.

4)sending the file to client by setting the mime type to excel

Problem:

step three is not working. I am unable to hide the "Please wait" message or
refresh the content1 page.

How can in hide the message or refresh page? I am using asp.net 2 and Visual
Studio 2005
----------------
//1)CLIENT SCRIPT--.ASPX

<asp:Button ID="ButtonPrint" runat="server" Text="Print Excel"
OnClick="ButtonPrint_Click" />

function WaitMsg(value)
{

if (value==true)
{
document.getElementById('<%= LabelWaitMsg.ClientID
%>').style.display='';
}
else
{
document.getElementById('<%= LabelWaitMsg.ClientID
%>').style.display='none';
}
return false
}
//---------------------------------------

protected void Page_Load(object sender, EventArgs e)
{
this.ButtonPrint.Attributes.Add("onclick", "WaitMsg(true);");

}


protected void ButtonPrint_Click(object sender, EventArgs e)
{

//2)WORKING
//create REPORT EXCEL FILE AND SAVE THE FILE
//CODE HERE

//3)NOT WORKING --HIDE THE MESSAGE******* I WANT TO CLEAR THE PAGE
OR HIDE THE WAITMSG
LabelWaitMsg.Visible = false;



//4)WORKING--I GET A DIALOGBOX TO SAVE/OPEN THE EXCEL FILE

Response.Clear();

Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=REPORt.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
Response.WriteFile(report);
Response.Flush();
Response.Close();

}


here is my code. I am new to asp.net 2.0(web). any help would be appreciated.
 
B

bruce barker

there is no event to notify the client code when the download completed.
you can use ajax to poll the server to ask when its complete. this poll
should not use session, or its requests will be queued up. or you can
make a session based poll (with a long timeout) and when it returns
clear the message.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top