You can use a static counter variable and use the label inside another updatepanel to achieve what you intend to do. I have added a dummy button to a second updatepanel whose click will be simulated via javascript in every 100 milliseconds in this example.
Try this
HTML:
<div>
<asp:UpdatePanel ID="UpdatePanelProcess" runat="server">
<ContentTemplate>
<asp:Button runat="server" Text="Process" ID="btnProcess" OnClientClick="Process();"
OnClick="btnProcess_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<asp:Button runat="server" Text="DummyButton" ID="btnDummy" Style="display: none;"
OnClick="btnDummy_Click" />
<asp:Label ID="lblCounterStatus" runat="server" ></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<script type="text/javascript">
function Process() {
var btn = document.getElementById('<%=btnDummy.ClientID%>');
btn.click();
setTimeout(Process, 100);
}
</script>
Code Behind:
protected void btnProcess_Click(object sender, EventArgs e)
{
Process();
}
static int counter = 1;
void Process()
{
for (counter = 1; counter < 10; counter++)
{
Thread.Sleep(1000);
}
}
protected void btnDummy_Click(object sender, EventArgs e)
{
lblCounterStatus.Text = counter.ToString();
}
Hope this helps.