locked
Label not updating while looping through code on aspx page RRS feed

  • Question

  • User-1795792116 posted

    Here's my scenerio, I have 4 checkboxes and 4 associated labels/progressbars and an Execute button.  Depending on if a checkbox is checked or not then the code loops through  the same sub-routine it just passes different parameters.  Throughout that sub-routine I have placed label.text with different percentage complete values.  I have placed the label itself inside an updatepanel, however the values never update until all the code has completed. 

    How do I get the Label to update on the aspx page whenever it hits a new label.text value?

    Monday, October 7, 2013 10:46 AM

Answers

  • User753101303 posted

    Hi,

    This is expected. ASP.NET runs server side and once completed it sends the resulting HTML markup to the browser where is displayed. So even altering the label hundreds of time will always just show the final value it has in the HTML markup (and even with an UpdatePanel you would need to trigger an update each time a value is set).

    Another approach would be to use SignalR : http://www.asp.net/signalr Then you can send a message to the browser from the server and you'll be able to consume this value immediately from your client side code.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 7, 2013 12:01 PM

All replies