Question: Below is my simple source code, I'm just trying to call that function after page load, but what is happening right now is: it calls that function before page load. Page loads for 5 seconds and, after that, it displays label execution.

```
protected void Page_Load(object sender, EventArgs e)
{
   display();
}

void display()
{
    Thread.Sleep(5000);
    Label3.Text = "done";
}

```

Answer: 
You should read [this document](https://msdn.microsoft.com/en-us/library/ms178472.aspx#general_page_lifecycle_stages) about ASP.NET Page Life Cycle. It actually says what you are trying to do is not possible.

Every code you write in the server side is going to run **before** the browser renders the page. That means you can not call a function after the browser renders the page, unless you use other approach.

The simplest way you can achieve this is using Javascript and an **Ajax call** or by using a `Timer`, which opens a new thread different from the main execution thread. Although, I do not recommend open new threads, because you will lose the control over the execution flow and in a webpage you could end having hundreds of open threads.
Below Code is Working

```
protected  void Page_Load(object sender, EventArgs e)
{
    Timer1.Interval = 2000;
    Timer1.Enabled = true;
}
protected void Timer1_Tick(object sender, EventArgs e)
{
        Label3.Text = "done";
}

```