Solved

asp.net label databinding static text

Posted on 2012-03-27
4
753 Views
Last Modified: 2012-03-27
Hi,

I have the following label

    <asp:Label ID="lblBedrooms" runat="server" Text='<%#Eval("Bedrooms") %>'></asp:Label>

which is fine as it displays what i want but I want static text which is bedroom but then after that i need another dynamic text called type

please help

Thanks,

R8VI
0
Comment
Question by:R8VI
  • 2
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
Comment Utility
Text='<%#Eval("Bedrooms") + " " + <%#Eval("Type")  %>'
0
 

Author Comment

by:R8VI
Comment Utility
Hi,

I tried this

 <asp:Label ID="lblBedrooms" runat="server" Text='<%#Eval("Bedrooms") +"Bedroom"+ <%#Eval("PropertyType")  %>'></asp:Label>

and this does not work

Thanks,

R8VI
0
 
LVL 13

Expert Comment

by:Rick
Comment Utility
You could always use 3 labels:

<asp:Label ID="lblBedrooms" runat="server" Text='<%#Eval("Bedrooms") %>'></asp:Label>
<asp:Label ID="lbBedroom" runat="server">Bedroom</asp:Label>
<asp:Label ID="lblPropertyType" runat="server" Text='<%#Eval("PropertyType") %>'></asp:Label>

Open in new window

0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
Comment Utility
Sorry about that, this works (tested):

Text='<%# String.Format("{0} {1} {2}", Eval("Bedrooms"),"Bedroom", Eval("PropertyType")) %>'
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

13 Experts available now in Live!

Get 1:1 Help Now