Reputation: 2819
I have a solution to this little problem, but I'm trying to get my head around what is happening.
I have a website with a label:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
And on Page_load I have:
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = "It is now: " + Environment.NewLine + DateTime.Now.ToShortTimeString();
}
Why does this not produce a new line / carriage return?
I have a solution but I'm just trying to grasp what is going on and why this doesn't work.
Upvotes: 1
Views: 3973
Reputation: 460238
A line break in html is <br>
:
Label1.Text = "It is now: <br>" + DateTime.Now.ToShortTimeString();
Upvotes: 2