How to insert a new line into database and read value onto my webgrid in razor MVC 3

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

-------------Problems Reply------------

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>), mvc 3 Views:0 Time:2012-04-17

Related post

  • Basic Rails question: manually inserting a row into a database table 2008-12-14

    I'm learning Rails and it's going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I've got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to

  • Cannot insert data into an sqlite3 database using Python 2009-07-29

    I can successfully use Python to create a database and run the execute() method to create 2 new tables and specify the column names. However, I cannot insert data into the database. This is the code that I am trying to use to insert the data into the

  • Nerddinner inserting longitude and latitude to database MVC 2010-06-09

    i am facing a problem in the nerddinner, what i am facing: in the DinnerForm.ascx there is a javascript code $(document).ready(function () { NerdDinner.EnableMapMouseClickCallback(); $("#Dinner_Address").blur(function (evt) { //If it's time to look f

  • can't insert russian text into mysql database 2010-12-10

    When I'm trying to insert russian text into MySQL database it inserts it like: г???????????? ?? ???????? Рісѓрїр°ріс‹рї р° с‹рір°рї So, I have two pages: registration.php and addUser.php. In each of them <meta http-equiv="Content-Type" content="te

  • How would I insert a variable into MSSQL Database from php? 2010-12-25

    mssql_query("INSERT into User_Shoutbox(user,message) VALUES('$user','$message')",$dbhandle ); This code inserts the Variables User and Message into the database. But this code keeps giving me an error... message: Incorrect syntax near the keyword 'us

  • How to insert an integer into a database through command prompt 2011-01-10

    I am trying to insert a integer into a database in C# using the code below, but everytime I run the compiler informs me that my integer is not a valid column "Invalid Column Name UserID" Does anyone have any insight on this? Thanks. Console.WriteLine

  • Question about inserting Users/Members into a database table! 2011-05-29

    My registration form has got a CreateUserWizard. I used its event that is fired after the user is created. Then I obtain the users identity and key. In the last line, I send the unique key to a function inside a class that should insert the key into

  • ASP: How to insert contents of array to database? 2011-07-18

    NOTE:, I don't need help with the generic concept of inserting data to a database, just sorting through the contents of an array depending on the content of the "line" and how to determine which "items" in the array correspond to a field in the datab

  • Insert Numpy array into Mysql Database 2011-08-12

    Starting with anwser of this: Using Numpy to create Yahoo finance price table import numpy as np import pylab as pl import urllib url = "

  • How can I insert arabic word to mysql database using java 2011-12-08

    I have a java application, want to insert arabic words to mysql database, my code looks like Connection con = null; String url = "jdbc:mysql://localhost/"; String db = "students"; String driver = "com.mysql.jdbc.Driver"; try { Class.forName(driver);

  • Inserting checkbox values into MySQL Database with PHP 2012-02-04

    everyone. I know this is a far treated subject, but I've looked everywhere and cannot get it solved. I have a series of checkboxes in my webpage and need to insert the values into a database. For what I've read, it's supposed to be done this way:

  • Entity Framework data insertion bad performance for a database with 750 tables 2012-02-29

    we have written a simple code to generate 750 classes with names from MyObj0 to MyObj749, each class has 1 int (ID) and 10 string properties, no navigation properties and no foreign keys for a start. The reason we're doing this is that we'd love to u

  • it is not inserting a value in the database 2012-03-30

    I am trying to insert a value in the database but when I open up the database the value is not inserted in the table. Now all of the code is correct in terms of no misspelling or anything like that but why isn't it inserting a value in the DB table?

  • Record is not getting inserted properly into ms access database using javascript 2014-01-07

    I am trying to insert a record into access database, and below code is working (Its inserting the data into the database.) but the data is not being inserted after the very last record, its getting inserted after some rows from the last record. Could

  • Emacs command to insert and indent line above cursor 2009-03-07

    I frequently find myself typing on a line, when I realize I need(ed) a variable definition (or something similar) on the line above. What I would like is to press C-return from anywhere on a line and have the cursor move to a newly inserted blank lin

  • How to insert a new line character after a fixed number of characters in a file 2009-07-27

    I am looking for a bash or sed script (preferably a one-liner) with which I can insert a new line character after a fixed number of characters in huge text file. --------------Solutions------------- How about something like this? Change 20 is the num

  • java 1.4 :how to insert multiple records in a database with one single hit using executeBatch? 2009-10-24

    i am reading records data from a file(records count can be up to thousands ).Now i want to insert each record in to database.I want to insert all of records in one hit to reduce performance hit. If i use addBatch(String sqlQuery ) on statment object,

  • How can I parse XML data and insert it into a MySQL database using Perl? 2009-11-17

    Here is the thing that I am trying to accomplish: In broader sense, parse the XML data using a SAX parser and insert it into the appropriate database column in a MySQL table. Here is sample Books.xml <?xml version="1.0" encoding="UTF-8"?> <!

  • Regex/Unix Tool to insert a new line before the beginning of every function definition in a C++ file 2009-11-28

    Edit: indent -bap foo.cpp works Is there any easy way to insert a new line or insert a text before the beginning of every function definition in C++ file? int main() { return 0; } void foo() { } becomes int main() { return 0; } void foo() { } -------

Copyright (C), All Rights Reserved.

processed in 0.156 (s). 11 q(s)