I have the following:
StringBuilder errors = new StringBuilder();
if(IsNullOrEmpty(value))
{
errors.AppendLine("Enter value");
}
if(IsNullOrEmpty(value2))
{
errors.AppendLine("Enter value 2");
}
I would expect this to display:
Enter value
Enter value 2
But it is displaying:
Enter value Enter value 2
I have also tried: AppendFormat("Enter value{0}",Environment.NewLine);
as well as with the \n character.
The errors string is outputted to an asp:Label like:
lblErrors.Text = errors.ToString();
As mentioned in some of the comments, HTML does not respect the new line character
\n. You need to use<br/>instead.