Click here to Skip to main content
12,401,984 members (31,546 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET Javascript CSS HTML , +
This is the code for button on .aspx page when i click on this button
<asp:Button ID="Button_Login" runat="server" CssClass="button_Login" Text="Login" OnClientClick="show()" />
the java script functions
document.getElementById('light').style.display = 'block';
document.getElementById('fade').style.display = 'block'
are called BUT IT DOES NOT STAY !!!
<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>
<script type="text/javascript" >
    function show() {
    document.getElementById('light').style.display = 'block';
    document.getElementById('fade').style.display = 'block';
 
     }
</script> 
Posted 5-Feb-13 20:27pm
sr_24484
Updated 5-Feb-13 21:22pm
v4
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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...
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 6 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100