Welcome to MSDN Blogs Sign in | Join | Help

jhawk's WebLog

Jonathan Hawkins, Software Architect for ASP.NET, AJAX, Silverlight, .NET Framework
Executing code when an ASP.NET Atlas page first loads

Someone asked me how they could execute code when an Atlas page first loaded. In the 'Atlas' xml-script declarative section, add a load attribute to the <application element. The load attribute points to your javascript function. Its that simple.

<%@ Page Language="C#" %>
<html>
<head>
</head>
<body>
    <form ID="Form1" runat="server">
        <atlas:ScriptManager id="Script" runat="server">
        </atlas:ScriptManager>
    </form>
   
    <script type="text/javascript">
    function onLoad(){
        alert("Hello, run your code here!");
    }
    </script>

    <script type="text/xml-script">
        <page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
            <components>
                <application load="onLoad">
                </application>
            </components>
        </page>
    </script>
</body>
</html>

 

Posted: Friday, January 20, 2006 4:02 PM by jhawk

Comments

khuziz said:

Whats the recommended approach to simulate "Loading", what Gmail does when you click the mail; when using atlas:UpdatePanel?
# February 3, 2006 2:55 AM
New Comments to this post are disabled
Page view tracker