New Line Stringbuilder message Box C#

Asked

Viewed 327 times

0

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

but the result is this:

inserir a descrição da imagem aqui

I’d like you to stay line by line;

My implementation is like this :inserir a descrição da imagem aqui

When I’m debugging, no builder.append I already understand that the line break is not inserted.

at the end in Return json it goes back to the initial call in Javascript and shows the message:

modal.window({ alert: data.Mensagem });
  • it would have to post the code here and not the image, here where I am I can not load the images and besides it is easier for people to help you this way

  • Have you tried .AppendLine() instead of .Append()?

  • the friend below helped me. had already searched by lot. had not found anything.

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 
            });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.