title: How can I display text with carriage returns in a GridView in ASP.Net
body: <p>I'm trying to display records within my GridView and a few of the cells contain text with carriage returns. However when this text is displayed the carriage returns are gone. Is there an easy way to display carriage returns in a GridView Cell?</p>
  
  <p>I've tried using a TextBox within the cell which works but I then have the scollbars of the TextBox. I'm not too keen on this way either as the textbox may render differently in different browser.</p>
  
  <p>My code is displayed below, I've left my testing in there so you can see all the ways I've tried: </p>
  
  <pre><code>&lt;asp:GridView ID="gridResults" runat="server"  AutoGenerateColumns="false" CellSpacing="-1" 
              CssClass ="stretch separate" GridLines="None" EnableViewState="true"&gt;
              &lt;HeaderStyle CssClass="header pad" /&gt;
              &lt;RowStyle CssClass="row pad"/&gt;                
              &lt;EmptyDataRowStyle CssClass="empty pad" /&gt;
              &lt;Columns&gt;
                  &lt;asp:BoundField DataField="Notes" HeaderText="Notes"  HtmlEncode="true"&gt;
                      &lt;ItemStyle Width="100"   /&gt;
                  &lt;/asp:BoundField&gt;
                  &lt;asp:TemplateField HeaderText="Notes" &gt;
                      &lt;ItemTemplate&gt;
                          &lt;asp:Label ID="test" runat="server"   Text='&lt;%# Bind("Notes") %&gt;' /&gt;
                          &lt;asp:TextBox ID="textNotes" runat="server" CssClass="right"  TextMode="MultiLine" Text='&lt;%# Bind("Notes") %&gt;' BorderStyle="None" /&gt;
                      &lt;/ItemTemplate&gt;                        
                      &lt;ItemStyle Width="50" CssClass="right"  /&gt;
                  &lt;/asp:TemplateField&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>I'm using ASP.Net 4.0 and c#</p>
  
  <p>Thanks</p>