Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I tried below code in master page but it shows me error.Like
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

My code is here:
XML
<script type="text/javascript" language="javascript">
        var sessionTimeout = "<%= Session.Timeout %>";
        function DisplaySessionTimeout() {
            alert(sessionTimeout);
            //if session is not less than 0
            if (sessionTimeout >= 0)
            //call the function again after 1 minute delay
                window.setTimeout("DisplaySessionTimeout()", 5000);
            else {
                //show message box
                alert("Your current Session is over.");
            }
        }
    </script>
Posted
Comments
Irbaz Haider Hashmi 1-Feb-13 5:19am    
You can set the variable value from your page code
ScripManager.RegisterClientScriptBlock

if your javascript is in the head section of the page, try placing it at the end after body tag...
 
Share this answer
 
v2

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