New Line StringBuilder message Box C #

0

I would like to show in a messagebox the records with line break.

but the result is this:

I'dlikeyoutostaylinebyline;

Myimplementationlookslikethis:

When I'm debugging, in builder.append I realize that the line break is not inserted.

At the end in return json it returns to the initial call in JavaScript and displays the message:

modal.window({ alert: data.Mensagem });
    
asked by anonymous 05.05.2017 / 20:17

1 answer

4

This will be shown in an HTML, so, instead of adding Environment.NewLine , add <br/> .

var builder = new StringBuilder();

foreach(var item in tributoPagar)
{
    builder.Append("***");
    builder.Append(item.CodigoDocumentoPagar);
    builder.Append(" ");
    builder.Append("<br/>");
}

return Json(new RetornoFuncao 
            { 
                Sucesso = false, 
                Mensagem = "Os documentos abaixo já foram adicionados: " + builder 
            });
    
05.05.2017 / 20:25