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
Expected Output in one of my webgrid column:
Old Values are
Name = Yasser
Age = 24
and New Values are
Name = Yasser R
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.
With some help from Paul, I have managed to solve this problem
here is what I am using now
logGrid.Column(header: "Message", columnName: "Message", format: @<pre>@item.Message </pre>),