This is a migrated thread and some comments may be shown as answers.

Get Images from DB into Carousel

1 Answer 155 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Manjot
Top achievements
Rank 1
Manjot asked on 27 Apr 2020, 09:55 AM

Hi I am developing an application where Image URLs are saved onto a SQL database (Local paths) The images are in a JPEG/PNG format. Would it be possible to get the Image URLs from the database and insert them into the carousel? If so please can I get some help on how to do so :)

Kind regards

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 29 Apr 2020, 01:17 PM

Hello Manjot,

In this case, you should iterate through the image paths and create items with that image, then add these items to the RadCarousel.Items collection. Take a look at the following help article: https://docs.telerik.com/devtools/winforms/controls/carousel/getting-started

An example is demonstrated below:

public RadForm1()
        {
            InitializeComponent();

            CarouselEllipsePath path = new CarouselEllipsePath();
            path.Center = new Telerik.WinControls.UI.Point3D(50, 50, 0);
            path.FinalAngle = -100;
            path.InitialAngle = -90;
            path.U = new Telerik.WinControls.UI.Point3D(-20, -17, -50);
            path.V = new Telerik.WinControls.UI.Point3D(30, -25, -60);
            this.radCarousel1.CarouselPath = path;
            this.radCarousel1.VirtualMode = true;

            string[] filePaths = Directory.GetFiles(@"C:\Users\nkaraiva\Desktop\png", "*.png", SearchOption.TopDirectoryOnly);

            foreach (string fileName in filePaths) 
            {
                LightVisualElement item = new LightVisualElement();
                item.Image = Image.FromFile(fileName);
                this.radCarousel1.Items.Add(item);
            }
        }

I hope this helps. If you have other questions do not hesitate to ask.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Carousel
Asked by
Manjot
Top achievements
Rank 1
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or