I have a very simple asp:textbox
with the multiline
attribute enabled. I then accept just text, with no markup, from the textbox. Is there a comm
I know this is an old post, but I've recently been in a similar problem using C# with MVC4, so thought I'd share my solution.
We had a description saved in a database. The text was a direct copy/paste from a website, and we wanted to convert it into semantic HTML, using tags. Here is a simplified version of our solution:
string description = getSomeTextFromDatabase();
foreach(var line in description.Split('\n')
{
Console.Write("" + line + "
");
}
In our case, to write out a variable, we needed to prefix @
before any variable or identifiers, because of the Razor syntax in the ASP.NET MVC framework. However, I've shown this with a Console.Write
, but you should be able to figure out how to implement this in your specific project based on this :)