I would like to create a line break in the status message. This is the code I have tried but it wont create a new Line. I am using the Status Message that is used in Identity in Asp.net Razor.
On the cshtml page
<partial name="Status Message" model="Model.Status Message" />
on the same page I added the following to the scripts
<p style="white-space: pre-line">@Model.StatusMessage</p>
on the .cs page
if(user.WeeklyReminders != Input.WeeklyReminders)
{
StatusMessage = "Weekly Reminders email Notifications have been changed. n";
}
StatusMessage += "Sent";
Results is: Weekly Reminders email Notifications have been changed. Sent
I also tried +Enviroment.NewLine(); With the same result.
I want it to be
Weekly Reminders email Notifications have been changed.
Sent.
Thanks
2
Answers
I know of two methods you can try both and see which you understand
or just simply try this
It took me a while to realise what was happening and it really bothered me I could not break and debug what was going on.
You are talking about the Identity Status Message and it does not use the shared
_StatusMessage.html
, but it has its own version. You first have to scaffold it (or copy the shared version toAreasIdentityPagesAccount_StatusMessage.cshtml
) before you can edit it.If you wrap the status message in a
<div>
with the correctwhite-space
, it works as expected and the newlines in your string are honoured: