ImageGallery - Programmatic Binding

Main Image

Item 1 of 0
 
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB
This demo illustrates how easy it is to populate the RadImageGallery control using client-side logic. For that purpose one must create an ImageGalleryItem and add it to the ImageGalleryItemCollection. Below you can find a list of properties that could be set when a new instance of Telerik.Web.UI.ImageGalleryItem is created:
  • Owner
  • Width
  • Height
  • Title
  • Description
  • ImageUrl
  • ThumbnailUrl
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • images.js
<%@ Page Language="c#" Inherits="Telerik.ImageGalleryExamples.DataBinding.ClientSide.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <script src="images.js" type="text/javascript"></script>
    <script type="text/javascript">
        //<![CDATA[
        function pageLoad() {
            var imageGalleryItems = $find('<%=RadImageGallery1.ClientID%>').get_items();
            for (var i = 0; i < 11; i++) {
                var item = new Telerik.Web.UI.ImageGalleryItem({
                    title: images[i].title,
                    description: images[i].description,
                    thumbnailUrl: images[i].thumbnailUrl,
                    imageUrl: images[i].imageUrl
                });
                imageGalleryItems.add(item);
            }
        }
        //]]>
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-container size-wide">
        <telerik:RadImageGallery RenderMode="Lightweight" ID="RadImageGallery1" Height="600px" Width="800px" runat="server">
        </telerik:RadImageGallery>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?