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

Image URL instead of image data field

2 Answers 353 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
Saeid Kdaimati
Top achievements
Rank 2
Saeid Kdaimati asked on 07 Apr 2014, 08:22 AM
Hi,

Can I set images URL from a data source instead of image data field? In my situation, we save only image url in database.

Thanx 
Saeid

2 Answers, 1 is accepted

Sort by
0
Accepted
Konstantin Dikov
Telerik team
answered on 09 Apr 2014, 11:18 AM
Hello Saeid,

The RadImageGallery's DataImageField property accepts a binary image or a string representing the URL to the image from the database and it determines internally whether the data is a URL or a binary image.

An online demo for the requirement that you have could be found at the following link:
And following is a very simple example which demonstrated how to use the data source with URL for the images:
<telerik:RadImageGallery runat="server" ID="RadImageGallery1" OnNeedDataSource="RadImageGallery1_NeedDataSource"
     DataImageField="imageURL" DataTitleField="imageTitle"></telerik:RadImageGallery>

And the code-behind:
protected void RadImageGallery1_NeedDataSource(object sender, ImageGalleryNeedDataSourceEventArgs e)
{
    DataTable table = new DataTable();
    table.Columns.Add("ID", typeof(int));
    table.Columns.Add("imageURL", typeof(string));
    table.Columns.Add("imageTitle", typeof(string));
 
    (sender as RadImageGallery).DataSource = table;
}

Hope that helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Saeid Kdaimati
Top achievements
Rank 2
answered on 09 Apr 2014, 11:48 AM
Thank you Konstantin.
Tags
ImageGallery
Asked by
Saeid Kdaimati
Top achievements
Rank 2
Answers by
Konstantin Dikov
Telerik team
Saeid Kdaimati
Top achievements
Rank 2
Share this question
or