THEMES
THEME SETTINGS

Image and Data Navigation - Image Gallery Overview

FirstPrev123456NextLast v
FirstPrev123456NextLast v
About the Image Gallery

The DevExpress ASP.NET MVC ImageGallery extension displays image collections using a tabular layout with dynamic layout adaptation, an integrated pager and a built-in image slider.

Follow the three simple steps below to add a DevExpress ImageGallery extension and bind it to your data. It's easy as “M”, “V”, and “C”:

1. Model (the "M" in MVC). First, you will need a Model object for the DevExpress ImageGallery to bind to. Create a new data model using the Entity Framework wizard or LinqToSQL ORM from Visual Studio. However, you can use any model that supports the IEnumerable interface. You can also bind the ImageGallery to a folder within your project.

2. View (the "V" in MVC). Now, you will declare the ImageGallery extension inside of the View. Specifically, you will create a Partial View because the DevExpress ImageGallery extension provides AJAX callbacks by default, to give your end-users a better experience without updating the entire page. However, because ASP.NET MVC does not support callbacks, declare the ImageGallery extension inside of a Partial View and define how the callbacks will be routed back to your controller using the CallbackRouteValues property:

Partial View code:

@Html.DevExpress().ImageGallery(settings => {
    settings.Name = "imageGallery";
    settings.CallbackRouteValues = new {
      Controller = "ImageGallery", Action = "OverviewPartial" };
    settings.ImageCacheFolder = "~/ImageGallery/Thumb/";
    settings.SettingsTableLayout.RowsPerPage = 1;
    settings.SettingsTableLayout.ColumnCount = 3;
}).BindToFolder(Model).GetHtml()


3. Controller (the "C" in MVC). Finally, the controller is where you will need to define the action methods that will handle the ImageGallery callbacks. The "OverviewPartial" action method below handles the callbacks. As you can see, the native DevExpress ImageGallery extension follows the ASP.NET MVC pattern while providing powerful features for your end-users.

Controller code:

public class HomeController: Controller {
  public string ImageSourceFolder = "~/Images/photo_gallery";
  public ActionResult Overview() {
    return View("Overview", ImageSourceFolder);
  }
  public ActionResult OverviewPartial() {
    return PartialView("OverviewPartial", ImageSourceFolder);
  }
}

Resources to Learn
Key Features
  • Binding to Data
    You can bind an ImageGallery to a data source so that your data items are retrieved from a folder, an XML file or an IEnumerable object.
  • Endless Paging
    The ImageGallery extension supports an endless paging mode that allows the loading of items on demand.
  • Built-in Pager
    ImageGallery automatically splits content across multiple pages, and provides a built-in pager that enables end-users to navigate through data.
  • Template Technology
    Templates are fully supported. For each element within ImageGallery, you can customize the appearance or layout using any HTML content.
  • Rich Client-Side Functionality
    A comprehensive client-side API is available for ImageGallery. This functionality, coupled with the ability to handle events on the client side, gives you full control over the extension's behavior on the client side.
Version: v2016 vol 2.4
Copyright © 2006-2017 Developer Express Inc
Your Next Great MVC App Starts Here

Get started today and download your 30-day trial of DevExpress MVC Extensions (includes 30 days of free technical support).

All demos ship with full source code and are included in the DevExpress MVC distribution. Refer to the Demos and Sample Applications topic to learn more.

DevExpress MVC Extensions ship as part of DevExpress Universal, DXperience and ASP.NET Subscriptions and are backed by a 60 day unconditional money-back guarantee.
To learn more and obtain pricing information, visit the Compare Features and Pricing webpage. For immediate assistance, contact us by Email at info@devexpress.com or by phone at +1 (818) 844-3383 between 7:30am and 4:30pm Pacific Time.