My colleague Todd Anglin has already written a post about how to create a rotator control dynamically - you can read it here - How to Create RadRotator Programmatically
. Unfortunately, this code in that post is for the old RadRotator control and if you try to use it in the new ASP.NET AJAX version, you will notice that it will not compile. Fortunately, you can quickly fix that. Here is what you need to change: FrameTemplate
- this property has been replaced with ItemTemplate RadRotatorFrame
- this object has been replaced with RadRotatorItem
After you update the above names, you should be able to compile and run Todd's code.
Creating a RadRotator control from code is handy in many cases - for example if you are developing a web part or some other server control you wish to easily reuse in your application.
You can can get the updated demo code (C# and VB.NET versions) here: DynamicRotator