I have following static list which i am returning in my razorPage and displaying its properties on the page however escape characters "\n" are ignored in my View.
The list:
public static List<KalenderModel> GetEvents()
{
Events = new List<KalenderModel>()
{
new KalenderModel()
{
Id = 1,
Date = DateTime.Now,
Headline = "Grand Opening!",
Message = "We are proud to announce opening of our library! " +
"\nRegistering in our library allow you to borrow materials that are divided into 3 different categories: Books, E-books and Movies. " +
"\nFurthermore from time to time we will announce various interesting and valuable events, so chceck this page frequently! " +
"\nWelcome!"
}
};
return Events;
}
And the View:
@{
foreach (var evenemang in Model.Events)
{
<div class="card text-center">
<div class="card-header">
</div>
<div class="card-body">
<h5 class="card-title">@evenemang.Headline</h5>
<p class="card-text">@evenemang.Message</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<div class="card-footer text-muted">
Posted: @evenemang.Date.ToShortDateString()
</div>
</div>
}
}
` – UnknownRori May 28 '22 at 09:37