Search code examples
c#asp.netmodalpopupextender

ASP.NET ModalPopupExtender Issue


I'm having an issue with a modal popup extender. What I'm doing is assigning it to a "hidden" button and on the click method of a different button, I'm calling modal.Show(); When the task behind is doing nothing, or small operations, it works just fine. The issue is when I make a call to a stored procedure, it doesn't show the modal at all. What I'm trying to do is prevent user clicks and notify the user that a process is running (ie. they click on a button and it needs a few seconds to pull all the data they requested).

Has anyone run into this before? Or have any tips?

Thanks in advance for any help!

EDIT:

Heres some sample code (as requested):

The .aspx page:

   <asp:Button ID="btnStep1Hidden" runat="server" style="visibility: hidden;" />
   <asp:Button ID="Step1" Text="Pull ID Cards" OnClick="Step1_Click" UseSubmitBehavior="false" runat="server" CssClass="button_menu" />
   <ajax:ModalPopupExtender ID="mpeStep1" runat="server" PopupControlID="panProgress" TargetControlID="btnStep1Hidden" BackgroundCssClass="modalBackground"></ajax:ModalPopupExtender>

The .aspx.cs code:

    mpeStep1.Show();

    try
    {
        SqlCommand cmd = APP.DataManager.GetConnection().CreateCommand();
        cmd.CommandText = "EXEC [dbo].[sp_Populate_Initial_DataSet_New]"            cmd.Connection.Open();
        cmd.ExecuteNonQuery();
        cmd.Connection.Close();
    }
    catch
    {
        //Log, etc here
    }

There are no .DataBinds() for that stored procedure. It merely populates a table that other processes will display the data from.


Solution

  • Is the modal popup going to say something like "please wait, processing..." ? You'll need to show it client-side rather than using mpeStep1.Show() otherwise it's not going to get around to displaying until the server-side stuff is finished anyway.

    Are you using ASP.NET Ajax? If so, would the UpdateProgress control not suit the task? http://msdn.microsoft.com/en-us/library/bb386421.aspx