Reputation: 1876
Let's say I would like to change the text of an element, during some long function in a script:
// Inside test.aspx.cs
void SomeLongFunction_CalledOnClick()
{
this.idOfElement.Text = "something";
}
When, precisely, is the client sent information about this update? Can I force it to happen earlier?
Upvotes: 0
Views: 70
Reputation: 12821
If you are using web forms, the content of the browser is updated when the "Render" stage of the page life cycle runs. Generally the code in a web form's code behind runs before the render stage.
Here is a link that explains the page lifecycle
I'm afraid that if you are looking to update the UI to indicate progress, the web forms model isn't made to work that way. All the content is sent to the browser as a single unit during the render phase.
If you want your UI to show progress you could poll for updates using ajax calls, or use a technology like SignalR (although it's probably overkill for your use case).
Upvotes: 1