Image URL instead of image data field

3 posts, 1 answers
  1. Saeid Kdaimati
    Saeid Kdaimati avatar
    48 posts
    Member since:
    May 2006

    Posted 07 Apr 2014 Link to this post


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

  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2409 posts

    Posted 09 Apr 2014 Link to this post

    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.

    Konstantin Dikov

    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.

  3. Saeid Kdaimati
    Saeid Kdaimati avatar
    48 posts
    Member since:
    May 2006

    Posted 09 Apr 2014 in reply to Konstantin Dikov Link to this post

    Thank you Konstantin.
Back to Top