Error on calling set_rotatorType

2 posts, 0 answers
  1. Samantha
    Samantha avatar
    50 posts
    Member since:
    May 2008

    Posted 08 Jan 2009 Link to this post

    I get an error when calling set_rotatorType (using some code in an example post here):

    [code]

    oRotator.set_rotatorType(Telerik.Web.UI.RotatorType.FromCode);

    [/code]

    null is null or not an object.

    I have the code in a RadCodeBlock and call the script from an onload on the body tag.  I'm using a RadScriptManager.  Do I need to include a path to some javascript files or something?

  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 10 Jan 2009 Link to this post

    Hi Samantha,


    You are working in an ASP.NET AJAX environment and in AJAX, all ASP.NET AJAX controls, including RadControls are created after the page is loaded - you can check that by examining the HTML dump.
    What happens is that when you try to execute the script on page's load, RadRotator will still not be rendered on the page which will cause the error.
    To avoid the problem, you should call the script on a later stage - for example in ASP.NET AJAX's generic pageLoad() function - it is called when all the controls are loaded
    e.g.
    function pageLoad()
    {
      //your code here
    }



    I hope this helps.

    Greetings,
    Fiko
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top