本文介绍了简单的AJAX进度信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在标签中输出当前进度信息?

我尝试使用下面的代码,但是没有刷新面板 - 除了在脚本的末尾。如果我用计时器替换按钮并使用timer.tick-event而不是button.click它可以工作。



[VB.net示例代码]

How can I output the current progress information in a label?
I tried to use the code below, but don't get a refresh of the panel - except on the end of the script. If I replace the button with a timer and use the timer.tick-event instead of button.click it works.

[VB.net sample code]

Protected Sub buttin1_Click(sender As Object, e As EventArgs) Handles button1.Click
    dim iCount as integer = 0
    For each row as datarow in tbl.rows
        '...do somethig...
        system.threading.thread.sleep(1500)
        i+=1
        info1.text = "Done " & i & " / " & tbl.rows.count & " rows.< br />"
    next
    
    info1.text &= "Complete."
end sub





[ASP.net示例代码]



[ASP.net sample code]

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel runat="server" ID="updatePanel1" UpdateMode="Always">
	<ContentTemplate>
                <asp:Button runat="server" ID="button1" Text="do something" />
        	<asp:Literal runat="server" ID="info1" />
	</ContentTemplate>
</asp:UpdatePanel>e

推荐答案

这篇关于简单的AJAX进度信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 22:11