Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
In my application calling different methods
this requierement im using like this

example:

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

       }

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.
Posted
Updated 6-Dec-11 0:40am
v4

1 solution

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.

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900