body onload event - timing problem?

Last post 11-30-2006 5:46 PM by shefali_sinha. 19 replies.

Sort Posts:

  • body onload event - timing problem?

    12-28-2005, 2:55 PM
    • Participant
      1,964 point Participant
    • Wallym
    • Member since 06-02-2003, 1:10 PM
    • Tennessee
    • Posts 361
    • ASPInsiders
      TrustedFriends-MVPs
    I've been trying to interrogate various objects. it seems that calling
    these methods as part of the body's onload event of a web page doesn't seem
    to work properly with Atlas. If I use a button's onclick event, everything
    seems to work properly. Is this a timing problem? if so, is there a proper
    way to get the onload event of a page to work?

    Wally

    --
    Wallace B. McClure
    "The Harder I Work, the Luckier I Get."
    Listen to "The ASP.NET Podcast" at http://www.aspnetpodcast.com/
    Database Award: http://url123.com/vc3er
    Microsoft MVP - Visual Developer ASP/ASP.NET
    AspInsider
    "AJAX for ASP.NET" Coming Soon!
    ADO.NET Book: http://url123.com/vc2bu
    865-693-3004
    118 Durwood Rd.
    Knoxville, TN 37922
    http://www.scalabledevelopment.com/
    Blog: http://weblogs.asp.net/wallym/
  • Re: body onload event - timing problem?

    12-28-2005, 3:30 PM
    • Participant
      1,454 point Participant
    • WilcoB
    • Member since 03-02-2003, 1:02 PM
    • Posts 290
    You should add a function called 'pageLoad', which will be called by Atlas (specifically the Application instance) once window.onload was raised and Atlas is done processing the markup.
    - Wilco Bauwer (MSFT) / http://www.wilcob.com
  • Re: body onload event - timing problem?

    12-28-2005, 4:36 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296

    Eventually, the pageLoad "magic" function will go away. Instead, you can already use the load event of the application object. In your xml-script section, add this to components:

    <application load="yourFunction"/>

    load is a full Atlas event, which means that you can also use declarative actions with it, for example to invoke a web service.

    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: body onload event - timing problem?

    12-28-2005, 6:32 PM
    • Member
      5 point Member
    • tingyiy
    • Member since 12-28-2005, 11:31 PM
    • Posts 1
    Where can I find complete documentation about all these tricks?
  • Re: body onload event - timing problem?

    12-28-2005, 9:04 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    Unfortunately, for the moment, the only documentation are the quickstarts and Wilco's class browser.
    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: body onload event - timing problem?

    01-01-2006, 6:06 PM
    • Member
      25 point Member
    • Thasmin
    • Member since 01-01-2006, 11:00 PM
    • Posts 5
    Putting my webservice call in a function called pageLoad instead of one that's called by the body's onLoad event seems to work in IE but not in Firefox 1.07. I just upgraded Firefox to version 1.5 and it still gives the same error.
  • Re: body onload event - timing problem?

    01-01-2006, 6:41 PM
    • Member
      25 point Member
    • Thasmin
    • Member since 01-01-2006, 11:00 PM
    • Posts 5
    I take the last post back. I'm having a lot of trouble getting the web service proxy to work even in IE.

    My code looks like this:
    // pageLoad is the Atlas load event
    function pageLoad()
    {
    alert(SimpleWS);
    }
  • Re: body onload event - timing problem?

    01-01-2006, 7:33 PM
    • Member
      25 point Member
    • Thasmin
    • Member since 01-01-2006, 11:00 PM
    • Posts 5
    I found out why it wasn't working on IE. It now works and I'm still trying to find out why it's not working in Firefox.
  • Re: body onload event - timing problem?

    01-01-2006, 7:51 PM
    • Member
      25 point Member
    • Thasmin
    • Member since 01-01-2006, 11:00 PM
    • Posts 5
    My problem might be related to the fact that I have two frames that have the same Atlas web reference. The problem was that in Debug/AtlasRuntime.js on lines 971, 981 and 988, baseName was not defined. It was defined on one frame and not the other. Specifically, I have two columns and it was defined in the first frame but not the second. I looked in AtlasCompat.js and replaced baseName with localName and that made it work fine. Hope this helps for the next CTP.
  • Re: body onload event - timing problem?

    01-01-2006, 11:46 PM
    • Member
      25 point Member
    • Thasmin
    • Member since 01-01-2006, 11:00 PM
    • Posts 5
    I found my problem. I was overwriting Atlas's Event object with my own. It wasn't an issue until I started using Atlas, of course.
  • Re: body onload event - timing problem?

    01-13-2006, 4:50 AM
    • Member
      133 point Member
    • kevbo
    • Member since 11-26-2005, 1:50 AM
    • Posts 29

    can you give me a clear example of application start calling into a javascript function?

    i can't seem to get it to work.

    thanks

     

  • Re: body onload event - timing problem?

    01-13-2006, 2:28 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296

    There already is an example in one of the previous post, but here you go:

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

    <script type="text/javascript">
     
    function yourFunction() {
        alert("Load function called.");
      }

    </script>

    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: body onload event - timing problem?

    01-13-2006, 7:54 PM
    • Member
      133 point Member
    • kevbo
    • Member since 11-26-2005, 1:50 AM
    • Posts 29

    strangely enough, this doesn't seem to work for me

    i cut and paste the example directly into the body element of an existing atlas web page, and it doesn't seem to work.

    is there something special i need to declare in the scriptmanager section?

     

  • Re: body onload event - timing problem?

    01-13-2006, 8:54 PM
    • Star
      13,895 point Star
    • bleroy
    • Member since 04-12-2003, 7:09 AM
    • Redmond
    • Posts 2,296
    Does anything else work?
    Bertrand
    ----
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: body onload event - timing problem?

    01-15-2006, 9:48 AM
    • Member
      133 point Member
    • kevbo
    • Member since 11-26-2005, 1:50 AM
    • Posts 29

    yes, i am able to make atlas calls back to a web service on this page

    i don't do any atlas UI stuff on the page.

     

Page 1 of 2 (20 items) 1 2 Next >