+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Widget with Image Url

Widget with Image Url

2 posts, 0 answered
  1. Jaime
    Jaime avatar
    5 posts
    Registered:
    23 Mar 2013
    23 Sep 2013
    Link to this post
    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!


  2. Jaime
    Jaime avatar
    5 posts
    Registered:
    23 Mar 2013
    23 Sep 2013 in reply to Jaime
    Link to this post
    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" />
2 posts, 0 answered