如何在ASP.NET中异步调用消息 [英] How to call message asynchronously in asp.net

查看:79
本文介绍了如何在ASP.NET中异步调用消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
在我的应用程序中调用不同的方法
我这样使用这个要求

例如:

hi all
In my application calling different methods
this requierement im using like this

example:

for (int i = 0; i <10; i++)
       {
           ScriptManager.RegisterStartupScript(Page, this.GetType(),"alert", "alert("window.alert('"+ i + "');";, true);

       }


这是示例

我对这种情况有什么期待
它可以在每个i值(例如0、1、2、3、4、5、6、7)上显示警报消息,就像这样

但它不会显示最后一个值0.

如何异步调用此循环


我想知道如何通过警报消息获取每个i值

任何帮助......

谢谢你.


this is example

what im expecting this condition
it can display alert message every i value like 0,1,2,3,4,5,6,7 like this

but it disyplay last value 0.

how to call asynchronously this loop


i want to know how to get every i value through alert message

any help...............

Thank u.

推荐答案

您拥有的代码在服务器上执行,并将多个脚本添加到呈现输出中,这些脚本立即全部流式传输到浏览器,但不会"请耐心等待,然后单击确定".

要按照您的要求异步执行此操作,需要使用JavaScript在客户端上完成.

The code you have is executed on the server with multiple scripts being added to the rendering output which is all streamed to the browser at once, it doesn''t wait for you click the OK before proceeding.

To do it asynchronously as you ask it will need to be done on the client with JavaScript.

<script langauge='JavaScript'>
function ShowAlerts()
{
  for(x = 0; x < 10, x++)
  {
    alert(x);
  }
}
</script>


这篇关于如何在ASP.NET中异步调用消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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