[英]asp.net - How can I update a text box asynchronously during a long process
I'm using MS Ajax toolkit and would like to be able to display status messages back to my user asynchronously. 我正在使用MS Ajax工具包,希望能够异步向我的用户显示状态消息。 I have an update panel wrapped around a text box, this is the desired destination for any update message.
我有一个围绕文本框的更新面板,这是任何更新消息的理想目标。 Inside the update panel I have a trigger pointing to the click event of the only button on the page.
在更新面板中,我有一个触发器,指向页面上唯一按钮的click事件。 I'm able to make the call to the method without a problem aber when I do something silly like
当我做一些愚蠢的事情时,我可以毫无问题地调用该方法
thisTextbox.text = "I know this is silly";
at the beginning of my long process...I don't get any update on the page. 在漫长的过程开始之初...页面上没有任何更新。 I'm missing something obviously, any help you can give would be appreciated.
我显然缺少了一些东西,您能提供的任何帮助将不胜感激。 Thanks
谢谢
on a side note, it it easy to get JQuery working in an ASP.net website? 附带说明一下,让JQuery在ASP.net网站上工作很容易吗? I tried with DOJO a few years ago and abandoned it for the pure asp "solution"
几年前,我尝试使用DOJO,并放弃了它作为纯ASP“解决方案”
Jim 吉姆
A synchronous status updates can be tricky. 同步状态更新可能很棘手。 It typically involves creating a separate thread to perform the long operation and building in a machanism for that thread to report its progress.
它通常涉及创建一个单独的线程来执行长时间操作,并建立一种机制来使该线程报告其进度。 The GUI can then poll the thread via a timed refresh to get the status.
然后,GUI可以通过定时刷新来轮询线程以获取状态。 Using the update panel makes this timed refresh appear a bit more smooth, but the same could be accomplished by refreshing the page or using an XMLHTTP request to poll the server for progress.
使用更新面板可使此定时刷新显得更加顺畅,但是可以通过刷新页面或使用XMLHTTP请求来轮询服务器以获取进度来实现相同目的。
Maybe I'm getting it wrong, but have you tried to say 也许我弄错了,但您是否想说
thisTextbox.text = "I know this is silly";
UpdatePanel1.Update();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.