Click here to Skip to main content
15,860,859 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
This is the code for button on .aspx page when i click on this button
ASP.NET
<asp:Button ID="Button_Login" runat="server" CssClass="button_Login" Text="Login" OnClientClick="show()" />

the java script functions
JavaScript
document.getElementById('light').style.display = 'block';
document.getElementById('fade').style.display = 'block'

are called BUT IT DOES NOT STAY !!!
CSS
<style type="text/css">
.black_overlay{
display:none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color:black;
z-index:1001;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
.white_content {
display:none;
position: absolute;
top: 25%;
left: 35%;
width: 35%;
padding: 0px;
border: 0px solid #a6c25c;
background-color: white;
z-index:1002;
overflow: auto;
}
.headertext{
font-family:Arial, Helvetica, sans-serif;
font-size:14px;
color:#f19a19;
font-weight:bold;
}
.textfield
{
border:1px solid #a6c25c;
width:135px;
}
.button2
{
 background-color:#a6c25c;
 color:White;
 font-size:11px;
 font-weight:bold;
 border:1px solid #7f9db9;
 width:68px;
}
</style>

JavaScript
<script type="text/javascript" >
    function show() {
    document.getElementById('light').style.display = 'block';
    document.getElementById('fade').style.display = 'block';
 
     }
</script> 
Posted
Updated 5-Feb-13 21:22pm
v4

if You're Doing PostBack On Button Click Event then Jquery will lose its state after postback means Login Pop-up will Disappear.

use this Thread-

http://stackoverflow.com/questions/1477219/jquery-fancybox-not-working-after-postback?rq=1[^]
 
Share this answer
 
XML
May be because of Postback your code is not working.

Look at code below....

<script type="text/javascript">
    function show() {
    document.getElementById('light').style.display = 'block';
    document.getElementById('fade').style.display = 'block';

    return false;
     }
    </script>

Here I included "return false". Which avoids postback for a button click and your code will work fine...

Hope it works...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900