Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PopUp div is not displaying by using Javascript function
------------------------------------------------------------
Js function
-------------------
C#
function btnExportLE_click() {
        debugger;
        document.getElementById('<%=dvladen.ClientID %>').style.display = "block";
        document.getElementById('<%=dvHider.ClientID %>').style.display = "block";
        return false;
    }


Style
-----
CSS
.dvladen
 {
     z-index: 2;
     position: absolute;
     width: 599px;
     height: 398px;
     border-width: 0px;
     top: 280px;
     left: 573px;
     background-color: White;
}


DIV
--------
XML
<div id="dvladen" runat="server" class="popup" visible="false" >
<p> HAIII</p>
</div>
<div id="dvHider" runat="server" class="hider">
</div>



Then I called Js function in Button Click

<asp:Button ID="btnExportLE" runat="server" class="btnNew" Text="Export LE"
OnClientClick="return btnExportLE_click();" />

PAge Load
----------
dvladen.Style["display"] = "none";


But It Showing An error like

JavaScript runtime error: Unable to get property 'style' of undefined or null reference


please help me to solve this..


Regards
Jithesh
Posted
Comments
kedar001 29-Oct-14 8:00am    
use
<div id="dvladen" runat="server" class="popup" style="display:none">
jithesh a 29-Oct-14 8:09am    
Thanks ALOT......

1 solution

Please check document.getElementById('<%=dvladen.ClientID %>') is throwing null. That's why style is not recognize . if you are not using master page then you can simply use Id of control without client Id.
 
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