my aim was not to close window unless user is entering correct password..
i have solved it by doing this way..
1)Window Pop Up on click of button
inside script tag--
function modalWin()
{
var WinSettings = "dialogWidth:400px;dialogHeight:120px;titlebar=no;toolbar=no"
var MyArgs = window.showModalDialog "../Master/Unlock.aspx",WinSettings);
if (MyArgs == null)
{
modalWin();
}
else
{}
}
2)Ok button on newly opened window and also for when user click close button of showModalDialog box
<script language=""javascript"">
function Done()
{
var txtenterpass = document.getElementById('<% =txtPass.ClientID %>').value;
txtenterpass = txtenterpass.replace(/\s+/g, "");
var txtstorepass = document.getElementById('<% =txtstorepass.ClientID %>').value;
txtstorepass = txtstorepass.replace(/\s+/g, "");
var MyArgs = new Array(txtenterpass);
window.returnValue = MyArgs
if(window.returnValue == null)
{
alert('enter password');
}
else{
if (MyArgs == "")
{
alert('enter password');
}
else
{
if(txtenterpass == txtstorepass)
{
window.returnValue = MyArgs;
window.close();
}
else
{
document.write("Password entered is not correct");
}
}
}
}
</script>