Solved

Container.dataitem with imagebutton

Posted on 2008-09-30
1
740 Views
Last Modified: 2008-09-30
The code is in a datalist and bind by an array.

With the following code the container.dataitem works well:
(<a href="Imovel.aspx?foto=<%# Container.DataItem%>"> <img alt="" src="imgimo/<%# xid %>/<%# Container.DataItem %>")
 
But with the following code don´t work, i think the problem is the imagebutton control, and for some reasons i prefer use imagebutton control. What´s wrng.  
(asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/ImgImo/<%# Container.DataItem%>")
<ItemTemplate>

                                        <a href="Imovel.aspx?foto=<%# Container.DataItem%>"> <img alt="" src="imgimo/<%# xid %>/<%# Container.DataItem %>" border="0" width="168" height="168" /></a><br />

                                        <br />

                                        <asp:ImageButton ID="ImageButton1" runat="server" 

                                            ImageUrl="~/ImgImo/<%# Container.DataItem%>" PostBackUrl="~/imovel.aspx" Width="150px" />

                                        <br />

                                        <asp:Label ID="Label1" runat="server" Text="<%# left(Container.DataItem,len(Container.DataItem)-4) %>"></asp:Label>

                                    </ItemTemplate>

Open in new window

0
Comment
Question by:rflorencio
1 Comment
 
LVL 18

Accepted Solution

by:
David Robitaille earned 500 total points
ID: 22606471

you need to string.concat the whole = string.
ImageUrl="~/ImgImo/<%# Container.DataItem%>")

ImageUrl='<%# string.concat("~/ImgImo/", DataBinder.Eval(Container.DataItem, "").tostring()) %>'  

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now