Edit this page

Carousel Items

You can add items to RadCarousel control by using the Items collection (programmatically or design-time), or by binding to a data source. You can use RadItem descendants to populate the RadCarousel.Items collection, for example RadLabelElement or RadButtonElement.

To add items to the carousel without data binding, use the Add method of the carousel collection. The example below adds a number of different RadItem types.

carousel-using-radcorousel-carousel-items 001

Adding Items

radCarousel1.Items.Add(new RadButtonElement("My Button"));
RadCheckBoxElement checkbox = new RadCheckBoxElement();
checkbox.Text = "My Checkbox";
radCarousel1.Items.Add(checkbox);
RadRadioButtonElement radio1 = new RadRadioButtonElement();
radio1.Text = "Choice 1";
radio1.ToggleState = ToggleState.On;
RadRadioButtonElement radio2 = new RadRadioButtonElement();
radio2.Text = "Choice 2";
RadRadioButtonElement radio3 = new RadRadioButtonElement();
radio3.Text = "Choice 3";
radCarousel1.Items.Add(radio1);
radCarousel1.Items.Add(radio2);
radCarousel1.Items.Add(radio3);

RadCarousel1.Items.Add(New RadButtonElement("My Button"))
Dim checkbox As New RadCheckBoxElement()
checkbox.Text = "My Checkbox"
RadCarousel1.Items.Add(checkbox)
Dim radio1 As New RadRadioButtonElement()
radio1.Text = "Choice 1"
radio1.ToggleState = ToggleState.On
Dim radio2 As New RadRadioButtonElement()
radio2.Text = "Choice 2"
Dim radio3 As New RadRadioButtonElement()
radio3.Text = "Choice 3"
RadCarousel1.Items.Add(radio1)
RadCarousel1.Items.Add(radio2)
RadCarousel1.Items.Add(radio3)

Deleting Items

To delete an entry from the carousel Items collection, use the Remove or RemoveAt methods. Remove takes the RadItem instance to be deleted and RemoveAt takes the index position of the item to be deleted:

Deleting Carousel Items

radCarousel1.Items.Remove(radCarousel1.Items[0]);
radCarousel1.Items.RemoveAt(0);

RadCarousel1.Items.Remove(RadCarousel1.Items(0))
RadCarousel1.Items.RemoveAt(0)

See Also