html helpers text input and line break

public string BannerText {get;set;}

public void SetBanner()
  BannerText = "This is line 1. \nThis is line 2."

in the aspx page I am setting it like this:

  <h1><%: Model.BannerText %></h1>

However, the text still shows up in a single line. I have tried <br /> and <br> as well but that doesn't seem to work. I am sure it has to be something simple, but need SO help :)

EDIT:Kirk Woll and Mike suggestion worked! use: <h1><%= Model.BannerText %></h1>


What is "<%:"? I haven't seen that before. Have you tried "<%="? That will use an HTMLTextWriter to pass the string to render. Then just use HTML (<br />) in your string.

First, \n will absolutely not work. This is HTML. You do need to use <br /> (or wrap them in <div>, etc.). However, the purpose of <%: (as opposed to <%=) is to HTML-encode your string. So presumably your line breaks (<br />) are being encoded. You should try <%= instead and see if that fixes your issue.

Need Your Help

Calculate percentage of zeros and ones in my vector?

matlab vector percentage transitions

I've already have my vector and number of zeros and ones with this code:

Zip error message in Python Pandas - Anaconda

python pandas zip python-3.4 anaconda

I am new to Python (and programming in general!), trying to conduct some data analysis using Pandas.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.