开发者

how to retain a button1 clicks action with a sleep against another button2 click action without sleep

My problem is I have two labels and two buttons in two different update panel in ASP.Net. The update panels contains two button开发者_JAVA技巧s. When buttons are clicked it will update the corresponding label text. The issue is, suppose I gave a delay of 5 seconds in my button1_click() method, when I click button1 and button2 immediately, label2 is gettin updated, whereas label1 is not getting updated.

Can you suggest where I'm going wrong?

protected void Button1_Click2(object sender, EventArgs e)
{
    System.Threading.Thread.Sleep(5000);
    Label1.Text = "Hello";
}

protected void Button2_Click1(object sender, EventArgs e)
{
    Label2.Text = "World";
}


In the Button Click Event, Update the Update Panel where the Second Label presents like below:

UpdatePanel2.Update();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜