Iam newbie to ASP.NET, and this is my first question on this forum. Here is my code:
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
Label2.Text = i.ToString();
UpdatePanel1.Update();
Thread.Sleep(3000);
}
}
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click"/>
<asp:Label ID="Label2" runat="server" Text=""></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
I want to display the value of i each time when its get updated, but I got the value 9. Please help me how can achieve my goal... No luck so far
Thread.Sleep(3000);and then actually checking the label to make sure it's being updated properly.