update label text inside content template

Reply Forum
Forum postaishev @ 2011-04-23 09:17:28
ReplyReply to
Hi all, I want to ask about update label inside content template in <asp:UpdatePanel>
It's just simple issue I want to ask, But I cant get answer yet...

Here is my aspx code :
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server/>

<asp:UpdatePanel runat="server" id="UpdatePanel1" updatemode="Conditional">

<ContentTemplate>
<asp:Label runat="server" id="label1" />
</ContentTemplate>
</asp:UpdatePanel>

<asp:Button ID="btn" runat="server" onclick="btn_Click" Text="click" />
</form>

and this is the code behind in cs :

protected void btn_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
for(int i=0;i<10;i++)
{
label1.Text = i.ToString();
UpdatePanel1.Update();
}



}

When I debugged it, it show label1.text = {0, 1, 2, ...9}
But, in the actual website, I just can see 9, I can't see the update label.text from 0 till 10 in the aspx file. What can I do?What additional syntax that I need. I've searched, but I have not get asnwer. Thanks for advance to all. Have nice day...











© net-tutorials.com 2006 - 2012

MailContact net-tutorials.com