Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi friends
I have one user control and my problem is i have hid show div using session values how to possible check session values in user control cs page and hide div in user control aspx page thanks to advance
Posted
Comments
Karthik_Mahalingam 7-Jan-14 4:55am    
div is in parent page ?

1 solution

Hi if your div is at server side control (runat=server) then you should take care of this solution.
C#
if(session["NAME"]!=null)
        div.visible=true;
else
        div.visible=false;


and if your div is at client side control then you should take care of this solutions.

JavaScript
<script type="text/javascript">
    function OnLoad()
    {

        var username = '<%= Session["UserName"] %>';
        if(username != null)
              document.getelementByID("div").style.display="none";
        else
              document.getelementByID("div").style.display="block";
    }
</script> 
 
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