Michael
Michael

Reputation: 21

Modal pop up while page load

My intention was to make a modal pop up window when I click a button which links me to another aspx page while it loads. I have the following codes:

  <script type="text/javascript"> 
     function showLoading() {
         $find('mpbLoading').show();
         $find('mpbLoading')._layout();
     }
     function hideLoading() {
         $.find('mpbLoading').hide();
         $.find('mpbLoading')._layout();
     }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" OnClientClick="showLoading()">LinkButton</asp:LinkButton>
</asp:Content>

There are also cs files which defines the show and hide function. But when i run the website it gives an exception:

JavaScript runtime error: unable to get property 'show' of undefined or null reference, and highlights $find('mpbLoading').show();

What did I do wrong? What are the methods I can use to accomplish the modal pop up? I was able to trace the problem to MicrosoftAjax.js. and it always returns null.

Thanks!

Upvotes: 0

Views: 177

Answers (1)

Sudipta Kumar Maiti
Sudipta Kumar Maiti

Reputation: 1709

Instead of $find('mpbLoading').show(); use $.find('mpbLoading').show();

Upvotes: 1

Related Questions