Console-ish在浏览器中输出,怎么样? [英] Console-ish output in a browser, how?

查看:60
本文介绍了Console-ish在浏览器中输出,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网络应用程序中,我想动态显示进程的进度,例如:


收集用户输入...

保存用户配置文件...

以PDF格式生成报告...

向用户电子邮件发送报告...


这类似于DotNetNuke的安装进度显示

或Oracle基于网络的企业管理器。


任何想法关于如何实施?我认为这是一个iframe,

但只是一个疯狂的猜测。


谢谢。

解决方案

完成了服务器推送。关闭页面缓冲区


DoSomeWork();

Response.Write(" working 1 ...< br>");

Rsponse.Flush();

DoSomeWork();

Response.Write(" working 2 ...< br>");

Rsponse.Flush();


标记必须简单,否则浏览器将无法呈现它直到所有这一切

收到了。


- 布鲁斯(sqlwork.com)

" gnewsgroup"写道:


在我的网络应用程序中,我想动态显示一个进程的进度

,如:


收集用户输入...

保存用户档案...

以PDF格式生成报告...

向用户电子邮件发送报告...


这类似于DotNetNuke的安装进度显示

或Oracle基于Web的企业管理器。


有关如何实现这一点的任何想法?我认为这是一个iframe,

但只是一个疯狂的猜测。


谢谢。


我的建议是使用ListBox控件并在向用户返回消息时将项目插入




使用。在零索引处插入()可确保最新消息显示在顶部

...


这是一个例子:


在您的ASPX页面上:


< div>

< asp:ListBox ID =" ConsoleOutput" RUNAT = QUOT;服务器" />

< / div>


在您的代码隐藏,课程等中:


//放一个项目对于控制台中的每一行输出。

ConsoleOutput.Items.Insert(0,收集用户输入...);

ConsoleOutput.Items.Insert(0,"保存用户profile ...");

ConsoleOutput.Items.Insert(0,以PDF格式生成报告...);

ConsoleOutput.Items.Insert (0,向用户电子邮件发送报告

....);


ConsoleOutput.Items.Insert(0,"收集用户再次输入...");

ConsoleOutput.Items.Insert(0,保存其他用户个人资料...);

ConsoleOutput.Items。插入(0,以PDF格式生成另一个报告

....);

ConsoleOutput.Items.Insert(0,"调度最终报告到

用户电子邮件...");


事件可以触发控件更新和/或将其放入UpdatePanel

所以你的用户可以看到它滚动...


HTH!


-dl

-

David R. Longn ecker
http://blog.tiredstudent.com


在我的网络应用程序中,我想动态显示一个进程的进度

,例如:


收集用户输入...

保存用户配置文件...

以PDF格式生成报告...

将报告发送给用户电子邮件.. 。

这类似于DotNetNuke的安装进度显示

或Oracle基于网络的企业管理器。


关于如何实现这一点的任何想法?我认为这是一个iframe,

但只是一个疯狂的猜测。


谢谢。




12月20日上午11点45分,布鲁斯巴克

< brucebar ... @ discussion.microsoft.comwrote:
< blockquote class =post_quotes>
完成服务器推送。关闭页面缓冲区


DoSomeWork();

Response.Write(" working 1 ...< br>");

Rsponse.Flush();

DoSomeWork();

Response.Write(" working 2 ...< br>");

Rsponse.Flush();



我以为它一定比这更棘手。将

Thread.Sleep(2000)在网页上工作?换句话说,下一次

输出会在2秒后出现吗?


DoSomeWork();


Thread.Sleep(2000);


Response.Write(" working 1 ...< br>");

Rsponse.Flush();

DoSomeWork();


Thread.Sleep(2000);


回复.Write(" working 2 ...< br>");

Rsponse.Flush();


之前我尝试过Thread.Sleep在网页中,它似乎不起作用。


In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...

This is something like the installation progress display of DotNetNuke
or the Oracle''s web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.

解决方案

its done with server push. turn off page bufferring

DoSomeWork();
Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();
Response.Write("working 2...<br>");
Rsponse.Flush();

the markup must be simple or the browser will not render it until all of it
is recieved.

-- bruce (sqlwork.com)
"gnewsgroup" wrote:

In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...

This is something like the installation progress display of DotNetNuke
or the Oracle''s web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.


My recommendation would be to use a ListBox control and insert items into
it as you return out messages to the user.

Using .Insert() at the zero index ensures that the newest messages show up
at the top...

Here''s an example:

On your ASPX page:

<div>
<asp:ListBox ID="ConsoleOutput" runat="server" />
</div>

In your code-behind, classes, etc:

// Put an "item" for each line in the "console" output.
ConsoleOutput.Items.Insert(0, "Collecting user input ...");
ConsoleOutput.Items.Insert(0, "Saving user profile ...");
ConsoleOutput.Items.Insert(0, "Generating report in PDF ...");
ConsoleOutput.Items.Insert(0, "Dispatching report to user email
....");

ConsoleOutput.Items.Insert(0, "Collecting user input again... ");
ConsoleOutput.Items.Insert(0, "Saving another user profile ...");
ConsoleOutput.Items.Insert(0, "Generating another report in PDF
....");
ConsoleOutput.Items.Insert(0, "Dispatching the final report to
user email ...");

Events could fire off the control updating and/or placing it in an UpdatePanel
so your users can see it "scroll"...

HTH!

-dl

--
David R. Longnecker
http://blog.tiredstudent.com

In my web application, I would like to dynamically display the
progress of a process, something like:

Collecting user input ...
Saving user profile ...
Generating report in PDF ...
Dispatching report to user email ...
This is something like the installation progress display of DotNetNuke
or the Oracle''s web-based enterprise manager.

Any idea about how this is implemented? I sorta think it is a iframe,
but just a wild guess.

Thanks.




On Dec 20, 11:45 am, bruce barker
<brucebar...@discussions.microsoft.comwrote:

its done with server push. turn off page bufferring

DoSomeWork();
Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();
Response.Write("working 2...<br>");
Rsponse.Flush();

I had thought that it must be something trickier than this. Will
Thread.Sleep(2000) work in a webpage? In other words, will the next
output appear after 2 seconds'' elapse like so?

DoSomeWork();

Thread.Sleep(2000);

Response.Write("working 1...<br>");
Rsponse.Flush();
DoSomeWork();

Thread.Sleep(2000);

Response.Write("working 2...<br>");
Rsponse.Flush();

I tried Thread.Sleep before in a webpage, it does not seem to work.


这篇关于Console-ish在浏览器中输出,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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