John Hadjioannou
Top achievements
Rank 1
John Hadjioannou
asked on 04 Jul 2009, 02:36 PM
I'm using a RadBinaryImage in a repeater to display a list of images from a db table. I'd like to make the images "clickable", redirecting to a url specified in the database row. Is there a way of setting the ImageUrl of a hyperlink to the RadBinaryImage - or some other way of achieving this?
Thanks
John
Thanks
John
2 Answers, 1 is accepted
0
Hello John,
This can be done by wrapping the RadBinaryImage instance inside an anchor tag and specifying the href of the anchor using a binding expression, for example:
where <SourceFieldUrl> is the name of the database field which holds the url.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
This can be done by wrapping the RadBinaryImage instance inside an anchor tag and specifying the href of the anchor using a binding expression, for example:
<asp:Repeater runat="server" ID="Repeater1" DataSourceID="SqlDataSource2"> |
<ItemTemplate> |
<fieldset style="float: left; width: 350px; height: 150px;"> |
<legend><b>Company Name</b>: |
<%#Eval("CompanyName")%></legend> |
<div class="details"> |
<div class="photo-container"> |
<a href='<%# Eval("<SourceFieldUrl>")%>'> <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("Photo") %>' |
AutoAdjustImageControlSize="false" Width="90px" Height="110px" ToolTip='<%#Eval("ContactName", "Photo of {0}") %>' |
AlternateText='<%#Eval("ContactName", "Photo of {0}") %>' /> </a> |
</div> |
<div class="data-container"> |
<ul> |
<li> |
<label> |
Contact Name:</label> |
<%#Eval("ContactName")%> |
</li> |
<li> |
<label> |
Title:</label> |
<%#Eval("ContactTitle")%> |
</li> |
<li> |
<label> |
City:</label> |
<%#Eval("City")%> |
</li> |
<li> |
<label> |
Country:</label> |
<%#Eval("Country")%> |
</li> |
<li> |
<label> |
Phone:</label> |
<%#Eval("Phone")%> |
</li> |
</ul> |
</div> |
</div> |
</fieldset> |
</ItemTemplate> |
</asp:Repeater> |
<div style="clear: both;"> |
</div> |
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>" |
ProviderName="<%$ ConnectionStrings:TelerikConnectionString.ProviderName %>" |
SelectCommand="SELECT TOP 6 * FROM [CustomerPhotos]"></asp:SqlDataSource> |
where <SourceFieldUrl> is the name of the database field which holds the url.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
John Hadjioannou
Top achievements
Rank 1
answered on 06 Jul 2009, 02:37 PM
Thank you!
John
John