# Other Programming > AJAX >  Show a ModalPopUpExtender from JavaScript

## Suzi167

Hey Everyone,

I have a ModalPopUpextender which shows up when teh page loads and I am usig it for the user to enter a username and password.

If the pasword is incorrect however, once the user clicks on the OK button I want the ModalPopUpExtender to NOT go away.
I tried many different things.
How can I make the dialog box Show when I wanted it from Java Script.

here is my code


```


 function test()
    {
       var password = document.getElementById('ctl00_ContentPlaceHolder1_txtPassword').value;
       var username = document.getElementById('ctl00_ContentPlaceHolder1_txtUserName').value;
       var response = _Default.Connect(username,password);
       if(response.value==1) //successful response
       {
       
       }
       else
       {
         alert("The Specified User Name or Password are invalid");
         
         //Below is what I've tried so far and is not working.
        //$find("OrderDetailClient").show();
        // $object('ModalPopupExtender1')._show();
        //$object('ModalPopupExtender1').show();
            $object('ModalPopupExtender')._show();             
            Sys.Application.load.add(showPanel);            
    
       }
    }

<div id="PanelInfo">
   <asp:Panel ID="Panel1" runat="server" Style="display: none" CssClass="modalPopup" >
     <table>
       <tr>
         <td><asp:Label runat="server" ID="lblUserName" Text="User Name:"/></td>
         <td><asp:TextBox runat="server" ID="txtUserName" /></td>
       </tr> 
       <tr>
         <td><asp:Label runat="server" ID="lblPassword" Text="Password:"/></td>
         <td><asp:TextBox runat="server"  ID="txtPassword" TextMode="Password" /></td>
       </tr>
       <tr>     
         <td>
             <input id="OKButton" type="button" value="OK" onclick="test()" style="width: 53px"  /></td>
         <td></td>
       </tr>
    </table>       
  </asp:Panel>



<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
            TargetControlID="Button1"
            PopupControlID="Panel1" 
            BackgroundCssClass="modalBackground" 
            OkControlID="OkButton"
            DropShadow="true"
            PopupDragHandleControlID="Panel3" BehaviorID="OrderDetailClient" />
```


Thanks very much in advance

Susan

----------


## wilz04

Hi, Suzi!!!

What is the _Default, Sys objects, and $find, $object functions, Where are the declarations???

----------


## PeejAvery

It looks to me that you have set up the ModalPopup incorrectly. Take a look here for a clearer look.

----------

