Click to See Complete Forum and Search --> : Show a ModalPopUpExtender from JavaScript


Suzi167
March 29th, 2007, 10:05 PM
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
March 30th, 2007, 10:26 AM
Hi, Suzi!!!

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

PeejAvery
March 30th, 2007, 02:01 PM
It looks to me that you have set up the ModalPopup incorrectly. Take a look here (http://www.geekzilla.co.uk/ViewDAAE6AAB-0369-45C2-BE78-B8E6F876B4F4.htm) for a clearer look.