I am using Razor, MVC3 with Poco entities.
While inserting into the database I am using Enviroment.NewLine as a seperator between two texts.
oldValues += " Name = '" + oldName.Name + "'" + Environment.NewLine ;
oldValues += " Age = '" + oldName.Age + "'" + Environment.NewLine ;
I am then assigning this oldValues string object to one of my columns in the database.
But when I am reading this value onto my webgrid, the formatting does not appear as expected.
What could be the problem here ?
Please suggest me some methods, I have also tried appending
<br />
tags too.
Expected Output in one of my webgrid column:
Old Values are
Name = Yasser
Age = 24
and New Values are
Name = Yasser R
Age =25
Actual Output in one of my webgrid column:
Old Values are Name = Yasser Age = 24 and New Values are Name = Yasser R Age =25
That’s the behavior of HTML. You can wrap your text with
<pre>Your String Here</pre>and it should display the text as you’re expecting it.