Widget with Image Url

Posted by Community Admin on 03-Aug-2018 05:11

Widget with Image Url

All Replies

Posted by Community Admin on 23-Sep-2013 00:00

I am creating a slider widget control which requires a consistent html element pattern. The pattern is used by a plugin that creates the slider. 

The pattern is as follows.

<div>
    <div>
       <img />
   </div>
</div>

The problem is that when I choose the image selector for my property (Image Property). The output is all mucked up. 

<div... with a whole bunch of other elements nested inside>
       <div><div> etc.. 
           <img  inside here somewhere />
     ....
</div>

Obviously this breaks the functionality that the plugin that I am using.

There are two solutions that I can think of 
1. Forget about the image selector and use just an image url (this kinda kills user friendlyness).
2. Somehow get the url from the image resource and bind it to an image in my widget template. 

Please someone tell me if the second way is possible. The following code is desired. 
<asp:Image ImageUrl='<%# Eval("<getimageurlsomehow_fromresource>")%>' runat="server" />

Thanking you in advance!


Posted by Community Admin on 23-Sep-2013 00:00

I was able to get this to work. It seems a bit hacky but will suffice. 

This works
<asp:Image ImageUrl='<%# (Container.DataItem as dynamic).Image[0].ChildItemAdditionalInfo %>' runat="server" />

And this works
<asp:Image ImageUrl='<%# Eval("Image[0].ChildItemAdditionalInfo") %>' runat="server" />

This thread is closed