I have a form with gridview that is bound to a complex stored procedure (financial data). This query takes about 3 minutes to run and load the gridview. The users get impatient and click "Search" repeatedly, which just makes things worse.
As an interim solution, I'd like to show a progress bar, and I found a solution using the ASP.NET AJAX ModalPopupExtender.
This is the code I have for adding the extender to the page:
<ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="Button1"
PopupControlID="pnlPopup" BackgroundCssClass="modalBackground" />
<asp:Panel ID="pnlPopup" runat="server" CssClass="updateProgress" style="display: none">
<div align="center" style="margin-top: 13px;">
<img src="../images/progress.gif" alt="Progress" />
<span class="updateProgressMessage">Loading ...</span>
</div>
</asp:Panel>
This is the very simple code for the button's click event:
protected void Button1_Click(object sender, EventArgs e)
{
gvInvoice.DataBind();
}
The problem is, when I click the Search button, the modal dialog pops up but the Databind() method never gets called. I tried using mdlPopup.Show()
but that doesn't show the dialog and instead just runs the Databind()
.
What am I missing? How do I ensure that the modal dialog appears, the databind runs, and the modal dialog subsequently disappears?