We have a requirement to build the html dynamically using string builder in custom web part i.e. CMSAbstractWebPart. We need to set src to image, the value is from page type field File.
we can set the image url to image in transformation like below but how can we set image url to image in custom web part code.
<img alt='<%# Eval("Title") %>' src='<%# GetFileUrl("ThumbnailImage") %>'/>
Do we have to convert the AttachmentBinary from "CMS_Attachment" where AttachmentGUID=@attachmentguid to image bytes? or is there any other way.
Thanks & Regards,
Try something like:
Attachment Guid should be stored into your file field.
Tried with with below but not working..Image is not rendering
src='/getattachment/" + drArticle["ThumbnailImage"].ToString() + ".aspx'
"<a href='/getattachment/" + attachment.AttachmentGUID + "/attachment.aspx'>" ==> IS WORKING FINE
Please, sign in to be able to submit a new answer.