?
Solved

asp.net label databinding static text

Posted on 2012-03-27
4
Medium Priority
?
763 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
ID: 37771485
Text='<%#Eval("Bedrooms") + " " + <%#Eval("Type")  %>'
0
 

Author Comment

by:R8VI
ID: 37771526
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
ID: 37771592
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 2000 total points
ID: 37771775
Sorry about that, this works (tested):

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

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

839 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