简体   繁体   English

加载数据为asp.net时更改处理页面

[英]Change processing page while loading data is asp.net

如何在asp.net中加载某个数据显示页面时显示处理页面?

I still like the classic 2 page solution. 我仍然喜欢经典的2页解决方案。 The first page has an BODY ONLOAD call that does "window.location = 'Page2.asp';". 第一页有一个BODY ONLOAD调用,执行“ window.location ='Page2.asp';”。 This results in the first page being displayed and the 2 page being invoked. 这导致显示第一页,并调用第二页。 While the second page is doing it's work the first page remains displayed. 当第二页正在工作时,第一页仍会显示。

There are a couple of "problems" with this solution: 此解决方案有两个“问题”:

  • User clicking refreshing will not take them to the first page (they are on the second page, and clicking refresh will start the second page loading again). 用户单击刷新不会将它们带到第一页(它们位于第二页上,单击刷新将再次开始第二页加载)。
  • This relies on the second page sending its results all at once (basically "buffered", which is the default). 这依赖于第二页一次发送所有结果(基本上是“缓冲的”,这是默认值)。

You could also do this with AJAX (all on one page): 您也可以使用AJAX来做到这一点(全部在一页上):

  1. Display a waiting message 显示等待消息
  2. Initiate the work with an AJAX load request 通过AJAX加载请求启动工作
  3. Once the load is complete rebuild the page or head of to a "completed" page. 加载完成后,将页面或页面的头重建到“完成”页面。

AJAX is nice, except that it may hide any server side errors that occur (ie if the page crashes horribly). AJAX很好,除了它可以隐藏发生的任何服务器端错误(即,如果页面崩溃严重)。 Also it depends on how you prefer to do ajax (jQuery vs ASP.NET Ajax vs XYZ). 此外,这取决于您更喜欢做ajax(jQuery vs ASP.NET Ajax vs XYZ)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM