I have a razor syntax like this:
foreach(var item in model)
{
6/16/2016 2:02:29 A
-
I also had an issue with multiline strings in this scenario. @Iman's backtick(`) solution worked great in the modern browsers but caused an invalid character error in Internet Explorer. I had to use the following:
'@item.MultiLineString.Replace(Environment.NewLine, "
")'
Then I had to put the carriage returns back again in the js function. Had to use RegEx to handle multiple carriage returns.
// This will work for the following:
// "hello\nworld"
// "hello
world"
// "hello
world"
$("#MyTextArea").val(multiLineString.replace(/\n|
/gi, "\r"));
- 热议问题