[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Container.dataitem with imagebutton

Posted on 2008-09-30
1
Medium Priority
?
769 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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 …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month20 days, 9 hours left to enroll

867 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