Click here to Skip to main content
15,886,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i just want to created a RDLC report and i want to remove "\n" (newline constraint) from the string i got from database. then i wrote a Expression in the RDLC to remove it as follows

C#
=First(Fields!conAddress.Value, "HAWBDt").ToString().Replace("\n"," ")


but it didn't worked.


the String i got form the database as follows and i want to remove that "\n" from the String.


2nd FloorHolden House,\n57 Rathbone Place,\nLondon,\nUK



if anyone could help me on this matter that would be a great help to me.thanks in advance!!!

Posted
Updated 16-Aug-12 10:40am
v3
Comments
[no name] 16-Aug-12 8:58am    
It did not work because you are trying to get rid of a newline and it's a slash and an n in the string (not a newline).
Hesha 16-Aug-12 9:02am    
yes.Agree.that's why i just put replace("\n", " ") so it should be replace? isn't it?
[no name] 16-Aug-12 9:07am    
No! That is replacing the newline "\n". It is not a newline in your string is it? try \\n

1 solution

Try escaping the slash because you really mean a backslash in this case:
C#
=First(Fields!conAddress.Value, "HAWBDt").ToString().Replace("\\n"," ")

Good luck!
 
Share this answer
 
Comments
Member 11704449 21-Jan-17 0:06am    
thanks
E.F. Nijboer 23-Jan-17 18:30pm    
Pretty old post, but happy it could still help you out :D

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