重新加载页面命令 [英] Reload Page Command

查看:116
本文介绍了重新加载页面命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1。我有一个由一个按钮启动的六个异步回调链,并希望

在每个回调结束时刷新页面以显示


A.结果显示累计运行时间的SQLServer查询,以及

B.进度条。


2.我使用刷新计时器:


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


3.然而,页面重新加载的闪烁令人讨厌,我更愿意在页面上显示

在每个回调EndInvoke的最后重新加载。


在C#中强制重新加载页面的命令是什么?


4.我的一个HandleCompletions如下所示,其中指示我需要重新加载页面的地方。


感谢您的帮助。


Alan


private void HandleUpdateCapitalCompletion(IAsyncResult asyncResult)


{


try


{


//检索更新委托对象


UpdateCapitalDelegate updateCapital =(UpdateCapitalDelegate)

asyncResult.AsyncState;


//调用EndInvoke获取UpdateCapital的结果

string updateCapitalResult = updateCapital.EndInvoke( asyncResult);


// ***在这里重新载入页面****


//星级链中的下一位代表


StartUpdateAverageCapitalDelegate();


}


catch(Exception ex )


{


//如果Update()抛出异常,EndInvoke将抛出异常


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


}


}

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());

}

}

推荐答案

当然是您要查找的命令:


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


" Alan Z. Scharf" <关于***** @ grapevines.com> aécritdansle message de

news:ea ************** @ TK2MSFTNGP11.phx.gbl ...
Certainly the command you look for :

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

"Alan Z. Scharf" <as*****@grapevines.com> a écrit dans le message de
news:ea**************@TK2MSFTNGP11.phx.gbl...
1。我有一个由一个按钮启动的六个异步回调链,并希望在每个回调结束时刷新页面以显示

A.显示累计运行时间的SQLServer查询结果,和
B.进度条。

2.我使用刷新计时器:

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

3.然而,页面重新加载的闪烁令人讨厌,我更愿意
在每次回调结束时重新加载页面EndInvoke。

在C#中强制重新加载页面的命令是什么?

4.我的一个HandleCompletions在下面,指的是我想要的地方重新加载页面。

感谢您的帮助。

Alan

private void HandleUpdateCapitalCompletion(IAsyncResult asyncResult)

{

尝试

//检索更新委托对象

UpdateCapitalDelegate updateCapital =(UpdateCapitalDelegate)
asyncResult.AsyncState;

//调用EndInvoke获取UpdateCapital的结果

字符串updateCapitalResult = updateCapital.EndInvoke(asyncResult);

// * **在此重新加载页面****

//在链中开始下一个代表

StartUpdateAverageCapitalDelegate();

}

抓住(ex Ex)

如果Update()抛出异常,EndInvoke将抛出异常

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


}
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());

}

}



嗨Alan ,


从您的描述中,您可以在asp.net页面的

服务器端代码中进行长时间操作,因此使用了不需要的asynthronous调用操作和

目前你使用< META http-equiv =" refresh" content =" 5">

标记用于刷新等待页面以便它会回发以检查异步

调用'的状态,但是你发现它会使页面

眨眼所以你想知道如何在他异步时将页面发回来

通过服务器端代码调用finshed,是吗? br />

至于这个问题,我的建议如下:

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

用于刷新页面(让它发布到服务器端),我们可以通过javascript实现
,比如form.submit();

这一切都是在客户端完成的,因为当一个页面被发送回客户端时,

与serverside没有关系,这也是

HTTP(无状态)应用程序的功能。所以我们不能在客户端打一个页面

通过在服务器端调用一个方法回发。


然而,至于你提到的页面闪烁根据我的经验,

大多数人经常使用隐藏框架或iframe页面来解决这个问题。我们可以

制作一个等待页面,其中包含一个嵌入的框架或iframe和框架

包含实际刷新页面,并设置框架的宽度和高度=

1以便隐藏它。然后,隐藏页面不断刷新,

主要等待页面不会闪烁。你觉得这个怎么样?


如果你有什么不清楚的地方,请随时在这里发布。谢谢。


问候,


Steven Cheng

微软在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)


在ASP.NET上获取预览whidbey
< a rel =nofollowhref =http://msdn.microsoft.com/asp.net/whidbey/default.aspxtarget =_ blank> http://msdn.microsoft.com/asp.net/whidbey /default.aspx

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


Steven,


感谢您的回复。


1.关于隐藏框架的使用,我是否仍能在某处显示

进度而不会闪烁?


现在,每次我的主页刷新时,它都会查询

SQLServer中的表,该表正在更新,累计运行时间结束时每个存储过程都在链中asynch电话。这个

累积时间表和其他指标随后显示在

转贴的数据网格中。


2.如果没有,然后你能提供关于重新提交的javascript的更多细节。


到目前为止,我将引用一个java命令:document.forms [0] .submit,但是

我不知道如何将它整合到我的.aspx页面。


问候,


Alan

Steven Cheng [MSFT]" <,V - ****** @ online.microsoft.com>在消息中写道

news:yk ************* @ cpmsftngxa10.phx.gbl ...
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]" <v-******@online.microsoft.com> wrote in message
news:yk*************@cpmsftngxa10.phx.gbl...
嗨Alan,
根据您的描述,您在asp.net
页面的服务器端代码中进行了长时间的操作,因此使用了一个不需要的调用来执行操作,目前您使用的是< ; META http-equiv =" refresh" content =" 5">
用于刷新等待页面的标记,以便它会回发以检查异步
调用的状态,但是您发现它将会生成页面
眨眼所以你想知道如何通过服务器端代码调用finhed来回发页面,是吗?

至于这个问题,这是我的建议:
< META http-equiv =" refresh" content =" 5">
用于刷新页面(让它发布到服务器端),我们也可以通过javascript执行此操作,例如form.submit(); 与服务器端无关,这也是基于HTTP(无状态)的应用程序的功能。所以我们不能在客户端做一个页面来通过在服务器端调用一个方法来回发。

然而,根据我的经验,你提到的页面闪烁,可以创建一个等待页面,其中包含一个嵌入框架或iframe,框架
包含实际刷新页面,并设置框架的宽度和高度
= 1以便让它隐藏起来。然后,隐藏页面不断刷新,主要等待页面不会闪烁。您如何看待这个?

如果您有任何不清楚的地方,请随时在此发布。谢谢。

问候,

Steven Cheng
微软在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有任何保证,也没有授予
权利。)

在ASP.NET上预览whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
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



这篇关于重新加载页面命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆