Module Builder and Images
I have a custom module that has a couple of image fields in it. I'm able to get the images perfectly fine from a code behind, but it's another story when I'm trying to do it in a widget template.
Is there an easy way to use images in a widget template? Should I be using one of your controls to do the job?
This is all I was able to figure out; it isn't pretty, and it actually only gives me the .tmb file.
<img alt='<%# Eval("Title")%>' src='<%# ((Telerik.Sitefinity.Model.ContentLinks.ContentLink[])Eval("MainImage")).LastOrDefault().ChildItemAdditionalInfo %>' />
Hi Patrick,
I believe the field you are looking for is "AssetsField". Here is an example from the Showcases module demo:
<
sf:AssetsField
ID
=
"AssetsField1"
runat
=
"server"
DataFieldName
=
"Screenshot"
Width
=
"205"
/>
Thanks, I knew there had to be a sf control that would do the trick.
Hi SelAromDotNet,
I need to add a title attribute in the img tag for my jQuery.
<img ... title="some text" .../>
I understand that sf:AssetsField will create an img tag. So I added the title attribute into an AssetsField,
<sf:AssetsField ... title="some text" .../>
but the generated img tag doesn't contain the title attribute. I am using Module Builder and don't have code behind. Is there any way around?
I'm trying to specify some static text in my hyperlink when using the document selector as a field. Anyone been able to do it? This does not work: <sf:AssetsField runat="server" DataFieldName="BusinessCard" Text="vCard" />
2 years on I'm hoping there's a solution to getting just the Image URL. I don't want all the extra divs the AssetsField wraps the image in. I only want the image. Thats it. I just want it to say
<
img
src
=
"locationOfMyImage.jpg"
/>
<
div
>
<
div
class
=
"sfimageWrp"
>
<
img
src
=
"locationOfMyImage.jpg"
/>
</
div
>
</
div
>
Does anyone know how to do this?