Solved

Container.dataitem with imagebutton

Posted on 2008-09-30
1
742 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

919 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

12 Experts available now in Live!

Get 1:1 Help Now