如何从没有回发的按钮点击事件asp.net动态设置标签值 [英] how to set a lable value dynamically from button click event asp.net without postback

查看:65
本文介绍了如何从没有回发的按钮点击事件asp.net动态设置标签值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个来自asp.net页面的标签。当我点击按钮事件时,我正在获得运行值。我需要将这些值显示到标签中,如运行状态,如

for(int i = 0; i< 10; i ++)

{

Label1.text = Convert.toString(i)

}

i have a label from asp.net page . when i click a button event i am getting running value .i nedd to display those value into a label like running status like
for (int i =0;i<10;i++)
{
Label1.text=Convert.toString(i)
}

推荐答案

这里的问题是代码会循环遍历0到9之间的所有数字,最后将数字9分配给Label。



所以,Label会显示9。



对于你要求的要求,你需要在数字出现之间加一些延迟。

你可以用 Window setInterval()方法 [ ^ ]使用 JavaScript

The problem here is code would loop through all the numbers from 0 to 9 and at last, assign the number 9 to the Label.

So, Label would show you 9.

For the requirement you are asking, you need to put some delay between the number appearance.
You can do that using Window setInterval() Method[^] using JavaScript.
Quote:

setInterval()方法调用函数或以指定的时间间隔计算表达式(以毫秒为单位)。

The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).

所以,试一试。


这篇关于如何从没有回发的按钮点击事件asp.net动态设置标签值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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