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

Error on calling set_rotatorType

1 Answer 57 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Samantha
Top achievements
Rank 1
Samantha asked on 08 Jan 2009, 12:10 PM
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?

1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 10 Jan 2009, 04:41 PM
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.
Tags
Rotator
Asked by
Samantha
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or