New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

ImageGalleryItemCollection Object

The ImageGalleryItemCollection available through the get_items() method of the RadImageGallery object holds the different items of type ImageGalleryItem containing data related to a certain image. The collection exposes methods listed in the table below.

ImageGalleryItemCollection methods

NameParametersReturn TypeDescription
add(item)ImageGalleryItemNoneAdds an item to the collection.
insert(index,item)ImageGalleryItem, NumberNoneAdds an item at a given position.
remove(item)ImageGalleryItemNoneRemoves an item from the collection.
removeAt(index)NumberNoneRemoves an item at a given position.
clear()NoneClears the items collection.
get_count()NumberReturns the number of items.
getItem(index)NumberImageGalleryItemReturns the ImageGalleryItem positioned at a given index.
indexOf(item)ImageGalleryItemNumberReturns the index of the given item. If such does not exist returns -1.
forEach(lamda)Function expressionNoneApplies the expression for every item in the collection.
toArray()ArrayReturns a JavaScript Array containing items of type ImageGalleryItem.

The example below illustrates how you can add a RadImageGalleryItem to the collection using the add() method.

ASPNET
<telerik:RadImageGallery RenderMode="Lightweight" runat="server" ID="RadImageGallery1" ></telerik:RadImageGallery>
JavaScript
function pageLoad() {
	var item = new Telerik.Web.UI.ImageGalleryItem({
		title: "Red Rose",
		description: "The beauty of the Red Rose",
		thumbnailUrl: "Images/Rose.jpg",
		imageUrl: "Images/Rose.jpg"
	});
	$find('<%=RadImageGallery1.ClientID%>').get_items().add(item);
}