0

I am working a program where one display item gets truncated. The Edit view uses a TextAreaFor and that works. The data in the TextAreaFor wraps.

     <span class="vertical-space spaced-field">@Html.TextAreaFor(m => m.Number, new { style = "width: 175px;"})</span>

But when the view displays it is truncated.

     <body>
        @foreach( var item in Model.OrderBy(p => p.EntryDate.Value))
        {
           <tr>
                .
                .
                <td>@item.Number</td>  ------  display truncated. Does not wrap
           </tr>
        }
      </body>

How would make it wrap like it does in the Edit view

1 Answers1

0

Have you declared your doctype and all other fun stuff?

It might be bcause you are using older methods to display the table. You could try styling the table with borders and so on in CSS - such as:

table, td, tr, th{
  border:1px solid #f0f;
}

.onepx{
  width:1px;
}



<div style="max-width:700px;">
  <table>
    <tr><td colspan="2">this is a loooooooooooooooong text</td></tr>
    <tr><td class="onepx">a:</td><td>b</td></tr>
    <tr><td class="onepx">c:</td><td>d</td></tr>
  </table>
<div>

and so forth - I am sure you get the idea. this might stop it automagically displaying in compatibility view (if it is the problem).

And finally, because IE9 is so stupid, you will have to turn off the compatibility view (if it is enabled on the page), because all pages within the domain will be viewed in compatibility view.

Bhushan Firake
  • 9,338
  • 5
  • 44
  • 79
  • I think I found the problem. I added the part to the and it still did not wrap until I noticed that it does wrap on white space. if you don't have any white space, it doesn't wrap. Do anyone know of a HTML helper that will wrap after a set number of characters? –  Dec 21 '12 at 20:07