Solved

Container.dataitem with imagebutton

Posted on 2008-09-30
1
751 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 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