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

Repeater Image

1 Answer 76 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
humam
Top achievements
Rank 1
humam asked on 21 Apr 2011, 10:30 PM
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">
<ItemTemplate>
       <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;">
                    </div>
                </div>
            </ItemTemplate>
        </asp:Repeater>


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,
humam.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 26 Apr 2011, 03:55 PM

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:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.aspx

http://support.microsoft.com/kb/307860



All the best,
Marin
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.

Tags
ToolTip
Asked by
humam
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or