Reputation: 8691
I am having issue inserting newline in the text message below. At the moment I am using Environment.NewLine but that doesnt seem to work. This is how it is showing.
Code
error =
@"You cannot split a sale@
<ul>
<li>With yourself.</li>
<li>A representative that has not completed their IBA and not been approved by compliance.</li>
<li>A terminated representative.</li>
</ul>".Replace("@", Environment.NewLine)
I basically want to show it like this
You cannot split a sale
• With yourself.
• A representative that has not completed their IBA and not been approved by compliance.
• A terminated representative.
EDIT
html
<div class="row">
<div class="col-12 col-lg-6">
<div *ngIf="infoMessage" class="notification warning">
<fa-icon [icon]="['fas', 'info-circle']"></fa-icon>
<span [innerHTML]="infoMessage"></span>
</div>
</div>
</div>
CSS
.notification {
background: #d3d3d3;
border-radius: 7.5px;
margin: 0 0 15px;
padding: 7.5px 10px;
width: 100%;
span {
display: inline-flex;
margin: 0 0 0 10px;
}
}
.notification.success { background: $notification-success; color: $white; }
.notification.warning { background: $notification-warning; color: $white; }
.notification.error { background: $pink; color: $white; }
Upvotes: 1
Views: 782
Reputation: 1290
You need to change
.Replace("@", Environment.NewLine)
by
.Replace("@", "<br />")
Environement.NewLine
is \r\n
This is pointless in HTML code.
<br />
is the equivalent in HTML code.
Why using <br />
instead of \r\n
, it because your error string seems to be interpreted when you are displaying it, looks like on a website. \r\n
would have been fin in desktop application.
Edit: Or you can update your initial code by the following one.
error =
@"You cannot split a sale
<p>
<ul>
<li>With yourself.</li>
<li>A representative that has not completed their IBA and not been approved by compliance.</li>
<li>A terminated representative.</li>
</ul></p>"
Code Snippet
You cannot split a sale
<p>
<ul>
<li>With yourself.</li>
<li>A representative that has not completed their IBA and not been approved by compliance.</li>
<li>A terminated representative.</li>
</ul>
</p>
<h4> Same With BR</h4>
You cannot split a sale
<br />
<ul>
<li>With yourself.</li>
<li>A representative that has not completed their IBA and not been approved by compliance.</li>
<li>A terminated representative.</li>
</ul>
Upvotes: 6