add_load or add_init?

2 posts, 0 answers
  1. Stephen
    Stephen avatar
    70 posts
    Member since:
    Mar 2008

    Posted 12 Oct 2009 Link to this post

    Is this the best way to accomplish this?  If use one other the other for all browser, one browser works and then the other stops working.

    Right now, for this to work in each browser I have to do the following...

    For Chrome/FireFox/Safari...  I have to call add_init

    For IE... I have to call add_load

        <script language="javascript" type="text/javascript"
            function OnLoad() { 
                var appVersion = navigator.appVersion; 
     
                if (appVersion.indexOf('MSIE') > 1) { 
                    Sys.Application.add_load( 
                        function() { 
                            var zoneDetails = $find('radZone1'); 
                            var zoneStatus = $find('RadDockZone1'); 
     
                            RestoreDocksInZone(zoneDetails); 
                            RestoreDocksInZone(zoneStatus); 
                        } 
                    ); 
                } 
                else { 
                    Sys.Application.add_init( 
                        function() { 
                            var zoneDetails = $find('radZone1'); 
                            var zoneStatus = $find('RadDockZone1'); 
     
                            RestoreDocksInZone(zoneDetails); 
                            RestoreDocksInZone(zoneStatus); 
                        } 
                    ); 
                } 
             
            } 
        </script> 
    </head>  
    <body onload="OnLoad();"
    ... 
    </body> 

    Thanks,
    Stephen
  2. Jim
    Jim avatar
    31 posts
    Member since:
    Jun 2009

    Posted 15 Oct 2009 Link to this post

    Try using the pageLoad() client function:

    <script type="text/javascript"
            function pageLoad() 
            { 
                  var zoneDetails = $find('radZone1');  
                  var zoneStatus = $find('RadDockZone1');  
                  RestoreDocksInZone(zoneDetails);  
                  RestoreDocksInZone(zoneStatus);  
            } 
     
    </script> 

    Also if you use any of the telerik's controls on the page try the Telerik static client library (read carefully). It is very handy in some scenarios.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top