Srivastava
Srivastava

Reputation: 3578

New line in the gridview

I have a webpage in which I let user to enter the contents, even if they change the line frequently in the textbox, the gridview when retrieves it from the database doesn't show any new line.

Upvotes: 2

Views: 5342

Answers (1)

Brissles
Brissles

Reputation: 3891

Try something like this in your RowDataBound event if you're using C#

e.Row.Cells[0].Text = e.Row.Cells[0].Text.Replace(Environment.NewLine, "<br/>");

where e.Row.Cells[0].Text is the text retrieved from the database.

Upvotes: 5

Related Questions