More in this section

Forums / Developing with Sitefinity / Image gallery > more columns

Image gallery > more columns

4 posts, 0 answered
  1. Devin
    Devin avatar
    149 posts
    Registered:
    09 Jun 2009
    16 Jun 2010
    Link to this post
    Hi how do I increase the number of columns in the image gallery?

    Thanks!
    Devin
  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    17 Jun 2010
    Link to this post
    Hi Devin,

    Could you please elaborate a bit? 
    Do you want to add new fields to each item in the library, and then to show this information in new columns in the image gallery? 

    Best wishes,
    Georgi
    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
  3. Devin
    Devin avatar
    149 posts
    Registered:
    09 Jun 2009
    17 Jun 2010
    Link to this post
    Hi Georgi,
    The List & page setting of the Image Gallery control defaults to three columns of thumbnails on the public site.  Is there a way that I can setup this control so that it displays 4 or more columns of thumbnails?

    Thanks!
    Devin
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    21 Jun 2010
    Link to this post
    Hello Devin,

    You could set how many items will be displayed per page which specify the number of columns of Image Gallery control. Implementing columns for ImageGallery will require a custom control where you need to inherits from Telerik.Libraries.WebControls.ImageGallery and override CreateContentList() method. Then you have to subscribe for ItemDataBound event of the Repeater control

    ListContainer.RepeaterControl.ItemDataBound where you need to add "ul" tags that will divide the columns. You should also implement a public property that will specify the number of columns

    public int NumberOfColumns
          {
              get
              {
                  object obj = ViewState["NumberOfColumns"];
                  if (obj == null)
                      return 2;
                  return (int)obj;
              }
              set
              {
                  this.ViewState["NumberOfColumns"] = value;
              }
          }

    Inside the ItemDataBound event you need to calculate the columns and items per page

    this.PageSize = dataSource.Count / this.NumberOfColumns;

    and bind the repeater.

    Greetings,
    Ivan Dimitrov
    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
Register for webinar
4 posts, 0 answered