Skip to main content

Bind Image Slider to a Folder

You can bind an image slider to a folder. To do this, set the ASPxImageSliderBase.ImageSourceFolder property to the path that takes you to the folder that contains images. The corresponding thumbnails are created automatically.

How to specify image folder at design time

<dx:ASPxImageSlider ID="ASPxImageSlider1" runat="server" ClientInstanceName="imageSlider" ImageSourceFolder="~\ImageSlider\images\portraits\">
     <SettingsImageArea ImageSizeMode="FillAndCrop" NavigationButtonVisibility="Always" />
     <SettingsNavigationBar Mode="Dots" ItemSpacing="0" />
</dx:ASPxImageSlider>

How to specify image folder at runtime

<dx:ASPxComboBox ID="cbSelectFolder" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cbSelectFolder_SelectedIndexChanged" SelectedIndex="0" >
     <Items>
          <dx:ListEditItem Selected="True" Text="Landscapes" Value="~\ImageSlider\images\landscapes\" />
          <dx:ListEditItem Text="People" Value="~\ImageSlider\images\people\" />
          <dx:ListEditItem Text="Photo Gallery" Value="~\ImageSlider\images\photo_gallery\" />
     </Items>
</dx:ASPxComboBox>

<dx:ASPxImageSlider ID="ASPxImageSlider1" runat="server" EnableTheming="false">
</dx:ASPxImageSlider>
protected void cbSelectFolder_SelectedIndexChanged(object sender, EventArgs e) {
     ASPxImageSlider1.ImageSourceFolder = cbSelectFolder.Value.ToString();
}
See Also