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

Clear all existing items

1 Answer 60 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Developer Developer
Top achievements
Rank 1
Developer Developer asked on 30 Sep 2010, 03:17 PM
I'm attempting to clear the items from an existing RadRotator, and replace them with new ones.  Does anyone know if the example below the correct way to do this, or what the best way would be?  Any help would be greatly appreciated.  Thank you!

// add first image to rotator
RadImageItem image = new RadImageItem();
image.Image = Image.FromStream(imageBuffer);
radRotator1.Items.Add(image);

// clear existing items so we can add new ones
radRotator1.Items.Clear();

// add a differrent image to the rotator
RadImageItem image2 = new RadImageItem();
image2.Image = Image.FromStream(imageBuffer2);
radRotator1.Items.Add(image2);
radRotator1.Items.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 05 Oct 2010, 04:46 PM
Hello Developer,

Thanks for the writing.

Your approach is correct - you can remove an existing item and add a brand new item containing another image.

It is also possible to change only the image of the existing item, for example:

image2.Image = Image.FromStream(imageBuffer2);
((RadImageItem)radRotator1.Items[0]).Image = image2;

I hope this will help. Do not hesitate to contact us if you have other questions.

 

Sincerely yours,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Rotator
Asked by
Developer Developer
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or