This is a migrated thread and some comments may be shown as answers.

add_load or add_init?

1 Answer 288 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 12 Oct 2009, 10:00 PM
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

1 Answer, 1 is accepted

Sort by
0
Jim
Top achievements
Rank 1
answered on 15 Oct 2009, 12:42 PM
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.
Tags
Dock
Asked by
Stephen
Top achievements
Rank 1
Answers by
Jim
Top achievements
Rank 1
Share this question
or