Repeater Image

2 posts, 0 answers
  1. humam
    humam avatar
    4 posts
    Member since:
    Mar 2011

    Posted 21 Apr 2011 Link to this post

    hi, I am facing a difficulty in understanding the retrieval of multiple images in this demo (here)
    based on the code provided:

    <asp:Repeater runat="server" ID="Repeater1" DataSourceID="SqlDataSource1" OnItemDataBound="repeater1_ItemDataBound">
           <div style="border: 1px solid #999999; float: left; margin: 3px; width: 125px; height: 125px;
             background-image: url('<%# Eval("ProductID", "../../../Img/Northwind/Products/{0}.jpg") %>');">
                        <div runat="server" id="smallImage" style="width: 125px; height: 125px; background-position: center;
                            background-repeat: no-repeat;">

    1) From where the background-image is taking the images, and what is this path?
    2) How can I store Images in the database and assign them to each product accordingly?

    Best Regards,
  2. Marin Bratanov
    Marin Bratanov avatar
    3555 posts

    Posted 26 Apr 2011 Link to this post

    Hi Humam,

    The images are located in a separate directory (with a relative path "../../../Img/Northwind/Products/"). You can examine it in your local installation folder under Live Demos, because you have the Online demos installed locally when you install the Telerik RadControls for ASP.NET AJAX package.

    The Eval command is run on the server and takes the ProductID from the database and uses it as the image name (the images are, therefore, named accordingly when created) - note the {0} placeholder that is used.

    For more information on how to use an asp repeater and the databinding options you can take a look at the following online resourses that a quick search on google turned up:

    All the best,
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. DevCraft R3 2016 release webinar banner
Back to Top