menu

arrow_back Writing formatted text to a database with output?

by
1 vote
ASP.NET Core MVC
In the text box to enter text with spacing and paragraphs, you need to write to the database so that the formatting is preserved (indentation, paragraphs).
Can you tell me how to do or where to find an article?

3 Comments

Roman Not where, but how.
freeExec , It will be displayed in two places, in the table and when editing this text in the input
How will you put this text back in?

1 Answer

by
 
Best answer
0 votes
private static String FormatOutput(string inStr)
{
return inStr.Replace("\n","<br/>").Replace(" ","&nbsp;");
}
as all leading spaces and line breaks are cut out in html. PS. Can be frozen more to cut out only the leading spaces. Yes store as is, and format before output