Telerik blogs
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

 


About the Author

Iana Tsolova

is Product Manager at Telerik’s DevTools division. She joined the company back in the beginning of 2008 as a Support Officer and has since occupied various positions at Telerik, including Senior Support Officer, Team Lead at one of the ASP.NET AJAX teams and Technical Support Director. Iana’s main interests are web development, reading articles related to geography, wild nature and latest renewable energy technologies.

Related Posts

Comments

Comments are disabled in preview mode.