Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Reload Page Command

Reply
Thread Tools

Reload Page Command

 
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-03-2004
1. I have a chain of six asynch callbacks initiated by a button, and want
the page to refresh at the end of each callback to display

A. Results of a SQLServer query showing cumulative running time, and
B. A progress bar.

2. I have this working with a refresh timer:

<META http-equiv="refresh" content="5">

3. However, the blinking of page reloads is annoying, and I'd prefer to have
the page reload at exactly the end of each callback EndInvoke.

What is the command to force page reload in C#?

4. One of my HandleCompletions is below, with the place indicated where I
want to reload the page.

Thanks for any help.

Alan

private void HandleUpdateCapitalCompletion(IAsyncResult asyncResult)

{

try

{

// Retrieve Update delegate object

UpdateCapitalDelegate updateCapital = (UpdateCapitalDelegate)
asyncResult.AsyncState;

//Call EndInvoke to get result of UpdateCapital

string updateCapitalResult = updateCapital.EndInvoke(asyncResult);

//*** RELOAD THE PAGE HERE ****

// Start next delegate in chain

StartUpdateAverageCapitalDelegate();

}

catch (Exception ex)

{

// Exception will be thrown by EndInvoke if Update() threw an exception

Console.Error.WriteLine(ex.ToString());

}

}


 
Reply With Quote
 
 
 
 
Saperlipopette
Guest
Posts: n/a
 
      05-03-2004
Certainly the command you look for :

Server.Transfer(Request.ServerVariables["SCRIPT_NAME"]);



"Alan Z. Scharf" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> 1. I have a chain of six asynch callbacks initiated by a button, and want
> the page to refresh at the end of each callback to display
>
> A. Results of a SQLServer query showing cumulative running time, and
> B. A progress bar.
>
> 2. I have this working with a refresh timer:
>
> <META http-equiv="refresh" content="5">
>
> 3. However, the blinking of page reloads is annoying, and I'd prefer to

have
> the page reload at exactly the end of each callback EndInvoke.
>
> What is the command to force page reload in C#?
>
> 4. One of my HandleCompletions is below, with the place indicated where I
> want to reload the page.
>
> Thanks for any help.
>
> Alan
>
> private void HandleUpdateCapitalCompletion(IAsyncResult asyncResult)
>
> {
>
> try
>
> {
>
> // Retrieve Update delegate object
>
> UpdateCapitalDelegate updateCapital = (UpdateCapitalDelegate)
> asyncResult.AsyncState;
>
> //Call EndInvoke to get result of UpdateCapital
>
> string updateCapitalResult = updateCapital.EndInvoke(asyncResult);
>
> //*** RELOAD THE PAGE HERE ****
>
> // Start next delegate in chain
>
> StartUpdateAverageCapitalDelegate();
>
> }
>
> catch (Exception ex)
>
> {
>
> // Exception will be thrown by EndInvoke if Update() threw an exception
>
> Console.Error.WriteLine(ex.ToString());
>
> }
>
> }
>
>



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-04-2004
Hi Alan,

From your description, you have a long-time operation at the asp.net page's
serverside code so used a asynthronous call to do the operation and
currently you use the <META http-equiv="refresh" content="5">
tag to refresh the waiting page so that it'll post back to check the async
call's state, but you found it'll make the page
blink so you're wondering how to make the page posted back when he async
call finshed via serverside code, yes?

As for this problem, here are my suggestions:
The <META http-equiv="refresh" content="5">
is used to refresh the page(let it post pack to the serverside), we can
also do this via javascript, such as form.submit();
All this is done at client, because when a page is sent back to client,
there is no relation with serverside, this is also the feature of the
HTTP(stateless ) based application. So we can't make a page at client to
post back via calling a method at serverside.

However, as for the page blinking you mentioned, based on my experience,
most one often use a hidden frame or iframe page to workaround this. We can
make a waiting page, which contain a embeded frame or iframe and the frame
contains the acutal refreshing page, and set the frame's width and height =
1 so as to make it hidden. Then, the hidden page is constantly refreshed,
the main waiting page won't be blinking. How do you think of this?

If you have anything unclear, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx



 
Reply With Quote
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-04-2004
Steven,

Thanks for your reply.

1. Regarding the use of a hidden frame, would I still be able to display
progress somewhere without blinking?

Right now, every time my main page refreshes, it queries a table in
SQLServer which is being updated with cumulative running time at the end of
each stored procedure in the chain of asynch calls. This table of
cumulative time and other indicators is then displayed in a datagrid on
repost.

2. If not, then can you offer more detail on javascript for resubmitting.

So far, I fould reference to a java command: document.forms[0].submit, but
am not sure how to integrate it into my .aspx page.

Regards,

Alan


"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Alan,
>
> From your description, you have a long-time operation at the asp.net

page's
> serverside code so used a asynthronous call to do the operation and
> currently you use the <META http-equiv="refresh" content="5">
> tag to refresh the waiting page so that it'll post back to check the async
> call's state, but you found it'll make the page
> blink so you're wondering how to make the page posted back when he async
> call finshed via serverside code, yes?
>
> As for this problem, here are my suggestions:
> The <META http-equiv="refresh" content="5">
> is used to refresh the page(let it post pack to the serverside), we can
> also do this via javascript, such as form.submit();
> All this is done at client, because when a page is sent back to client,
> there is no relation with serverside, this is also the feature of the
> HTTP(stateless ) based application. So we can't make a page at client to
> post back via calling a method at serverside.
>
> However, as for the page blinking you mentioned, based on my experience,
> most one often use a hidden frame or iframe page to workaround this. We

can
> make a waiting page, which contain a embeded frame or iframe and the frame
> contains the acutal refreshing page, and set the frame's width and height

=
> 1 so as to make it hidden. Then, the hidden page is constantly refreshed,
> the main waiting page won't be blinking. How do you think of this?
>
> If you have anything unclear, please feel free to post here. Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
>
>



 
Reply With Quote
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-04-2004
Saperlipopette,

I'm still trying to het this to work with my async callbacks.

Regards,

Alan


"Saperlipopette" <saperlipopette@null> wrote in message
news:4096abe9$0$8636$(E-Mail Removed)...
> Certainly the command you look for :
>
> Server.Transfer(Request.ServerVariables["SCRIPT_NAME"]);
>
>
>
> "Alan Z. Scharf" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed)...
> > 1. I have a chain of six asynch callbacks initiated by a button, and

want
> > the page to refresh at the end of each callback to display
> >
> > A. Results of a SQLServer query showing cumulative running time, and
> > B. A progress bar.
> >
> > 2. I have this working with a refresh timer:
> >
> > <META http-equiv="refresh" content="5">
> >
> > 3. However, the blinking of page reloads is annoying, and I'd prefer to

> have
> > the page reload at exactly the end of each callback EndInvoke.
> >
> > What is the command to force page reload in C#?
> >
> > 4. One of my HandleCompletions is below, with the place indicated where

I
> > want to reload the page.
> >
> > Thanks for any help.
> >
> > Alan
> >
> > private void HandleUpdateCapitalCompletion(IAsyncResult asyncResult)
> >
> > {
> >
> > try
> >
> > {
> >
> > // Retrieve Update delegate object
> >
> > UpdateCapitalDelegate updateCapital = (UpdateCapitalDelegate)
> > asyncResult.AsyncState;
> >
> > //Call EndInvoke to get result of UpdateCapital
> >
> > string updateCapitalResult = updateCapital.EndInvoke(asyncResult);
> >
> > //*** RELOAD THE PAGE HERE ****
> >
> > // Start next delegate in chain
> >
> > StartUpdateAverageCapitalDelegate();
> >
> > }
> >
> > catch (Exception ex)
> >
> > {
> >
> > // Exception will be thrown by EndInvoke if Update() threw an exception
> >
> > Console.Error.WriteLine(ex.ToString());
> >
> > }
> >
> > }
> >
> >

>
>



 
Reply With Quote
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-06-2004
Steven,

Thanks very much for your reply and the examples. I will try to work
through them tomorrow.

Regards,

Alan


"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Alan,
>
> Thanks for the followup. Well, I recommend you use the "hidden iframe"
> means.
> As for your situation, you can make the refresh page(which refresh once 5
> secs to serverside and query tables and update values in the page(you can
> store them in some <input type="hidden" > fields.
>
> then, embed this refresh page in the waiting page(display progress bar or
> something else) via
> <iframe id="frmRefresh" width="1" height="1" src="refresh.aspx" >....
> And you can use the javascript to retrieve the hidden fields(in the iframe
> page)'s value and use it to update your display page.
>
> To make it clearly, I've made two sample pages via C# code I've attached

it
> in the message. You can get it if you view this thread via OE client.
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx



 
Reply With Quote
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-06-2004
Hi Steve,

>>As for your situation, you can make the refresh page(which refresh once 5

secs to serverside and query tables and update values in the page(you can
store them in some <input type="hidden" > fields.<<

Right now I'm refreshing an entire datagrid with status values, not
individual fields.

Will I be able to use the refreshing datagrid on the Refresh page instead of
<input type="hidden" > fields?

I'm still experimenting with what you sent, but wanted to ask this question
in the meantime.

Thanks again..

Alan



"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Alan,
>
> Thanks for the followup. Well, I recommend you use the "hidden iframe"
> means.
> As for your situation, you can make the refresh page(which refresh once 5
> secs to serverside and query tables and update values in the page(you can
> store them in some <input type="hidden" > fields.
>
> then, embed this refresh page in the waiting page(display progress bar or
> something else) via
> <iframe id="frmRefresh" width="1" height="1" src="refresh.aspx" >....
> And you can use the javascript to retrieve the hidden fields(in the iframe
> page)'s value and use it to update your display page.
>
> To make it clearly, I've made two sample pages via C# code I've attached

it
> in the message. You can get it if you view this thread via OE client.
> Thanks.
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx



 
Reply With Quote
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-07-2004

Steven,

Thanks again for your reply and example.

I will go through it tomorrow.

>>only at the time

> the long-run operation has been finished, we display the final result to
> the users, do you think so?


I would still like to be refreshing periodically all the way through, rather
than just at the end, since it is a batch process that could take up to
sever minutes, depending on the size of the date ranged covered by the
process.

This web app is duplicating an Access front end to SQLServer that users are
used to. I've been able to duplicate everything, else including
mulltiple-row edits of a datagrid, but this refresh part has been difficult
due to not being connected directly to the database.

When I make a little more progress, I will send you the url of the page
being refreshed.

Thanks again for your help.

Regards,

Alan

"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:$(E-Mail Removed)...
> Hi Alan,
>
> Thanks for the followup. You mentioned that you'll need to query some
> certain tables and retrieve out the datas and stored in a datagrid in the
> refreshing page? I'm not sure whether you want to just display the changed
> data in a datagrid and show to the users. If so, I think its also ok to

put
> the datas in the datagrid on the refreshing page(in the iframe) and use
> javascript to get the datagrid's clientside html and display in the
> container page(waiting page) which is actually displayed to the users.

I've
> attached my modified demo pages in this message regarding on this means.
>
> Also, I also think since you use refreshing page and waiting page is just
> to wait for a long-run operation to finish. So it's better that we put

less
> displaying logic in refreshing page or waiting page, and only at the time
> the long-run operation has been finished, we display the final result to
> the users, do you think so?
> If you have any updates, feel free to post here. Thanks.
>
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx



 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      05-08-2004
Hi Alan,

You're welcome. If you have any new findings or need any further help,
please feel free to post here .Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


 
Reply With Quote
 
Alan Z. Scharf
Guest
Posts: n/a
 
      05-10-2004
Steven,

I was able to get things working by swapping in my components into your
files. They were invaluable!

I have a couple questions remaining, but just now trashed my files somehow -
getting Fatal Engine Execution Error when try to open files in VS.NET.

After I rebuild them I will followup.

Thanks again.

Regards,

Alan



"Steven Cheng[MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Alan,
>
> You're welcome. If you have any new findings or need any further help,
> please feel free to post here .Thanks.
>
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using refresh to reload page, problem is it loads header, footer andeverything, can I avoind those to reload? VT HTML 8 10-13-2010 11:09 PM
JavaScript refresh: <a href="#" onClick="window.location.reload( true );">Reload</a> Joshua Beall HTML 26 06-29-2007 06:31 PM
problem with reload(sys) (doing reload on the sys module) gen_tricomi Python 2 05-23-2006 10:03 AM
Is there an SNMP equivalent to "Reload in [x]" / "Reload cancel" commands? steve.chambers@gmail.com Cisco 5 05-20-2006 04:06 AM
How to get and cancel the reload event (F5, Reload nutton, ...) within a browser Stefan Mueller Javascript 4 11-05-2005 06:09 PM



Advertisments