Display progress only when grids are getting loaded

In my application I have two drop downs. On changing the drop down selection I load multiple grids in a tree structure, but loading these grids takes some time (nearly 5 minutes to load all of them). Because of this, I have opted to show the loading progress using the code below:

Aspx code:

<form>
<img style="visibility:hidden;" src="~/Image/loader.gif" runat="server" id="loading_image" />
<asp:DropDownList ID="ddl1" runat="server" Height="22px" Width="121px" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
<asp:DropDownList ID="ddl2" runat="server" Height="22px" Width="121px" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged" AutoPostBack="True">
</asp:DropDownList>
</form>

protected void Page_Load(object sender, EventArgs e)
{
ddlYear.Attributes.Add("onchange", "document.getElementById(\"loading_image\").style.visibility = \"visible\";");
}

protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
{
i = 0;
imgid.Visible = true;
imgid1.Visible = true;
imgid2.Visible = true;
imgid3.Visible = true;
imgid4.Visible = true;
imgid5.Visible = true;
imgid6.Visible = true;
lbl1.Visible = true;
lbl2.Visible = true;
lbl3.Visible = true;
lbl4.Visible = true;
lbl5.Visible = true;
lbl6 = true;
if (ddl1.SelectedItem.Text != "Select")
{
lbl2.Text = ddlYear.SelectedItem.Text;
DataBind(Session["abc"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());
Bind(Session["dept"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());
}
}

protected void ddl2_SelectedIndexChanged(object sender, EventArgs e)
{
i = 0;
imgid.Visible = true;
imgid1.Visible = true;
imgid2.Visible = true;
imgid3.Visible = true;
imgid4.Visible = true;
imgid5.Visible = true;
imgid6.Visible = true;
lbl1.Visible = true;
lbl2.Visible = true;
lbl3.Visible = true;
lbl4.Visible = true;
lbl5.Visible = true;
lbl6 = true;
if (ddl1.SelectedItem.Text != "Select")
{
lbl2.Text = ddlYear.SelectedItem.Text;
DataBind(Session["abc"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());
Bind(Session["dept"].ToString(), ddl1.SelectedItem.Text, Session["name"].ToString());

}
}The problem with above code is the loading progress is always getting displayed, even after the grids are loaded. However I need to display the loading progress only for the time when grids are getting loaded, and once they have finished loading the loading progress should not appear. How can I do this?