Click here to Skip to main content
15,907,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to display address in multiple line in repeater based on comma.
From backend i'm retrieving address


<asp:Label ID="lbl_address" runat="server" Font-Bold="true" Text='<%#Eval("contact_address")%>' ></asp:Label>



backend i have stored like this..

dharshan,Electronic city,bangalore.



i need to dispaly like this..

dharshan,
Electronic city,
bangalore.

How to do that?


thanks in advance..
Posted
Updated 5-Jun-14 1:35am
v3

You can just add
C#
<br />
after the commas. That's a line break in html.

[Edit Nazia]
Modified the pre tags as the "break" specified didn't appeared in the solution if the pre tag is lang="Text"
[/Edit]
 
Share this answer
 
v2
Comments
ZurdoDev 5-Jun-14 9:09am    
@Nazia, thanks for the edit. What's weird is when I clicked "Submit your solution" it actually did show the br. But when I look at the revision it does not show. Thanks for fixing.
Something like this should help:
ASP.NET
<asp:label id="lbl_address" runat="server" font-bold="true" text='<%#Eval("contact_address").ToString().Replace(",",",<br />")%>'></asp:label>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900