This is a migrated thread and some comments may be shown as answers.

[Solved] Notes column in grid

1 Answer 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
FinallyInSeattle
Top achievements
Rank 1
FinallyInSeattle asked on 07 Oct 2011, 08:26 PM
I have a grid where one of the columns is a Notes column (multi-line).  I have added an EditorTemplate (below) to support a larger area for edit.
EditorTemplate:
 
@model System.Web.Mvc.ViewUserControl<String>
@Html.TextAreaFor(m => m, new { rows = 6, cols = 120, wrap = "hard", style="text-overflow:ellipsis;" })

Once a record is saved, I don't want the user to be able to modify it.  But, I do need a way for the user to be able to see the entire value (with carriage returns - I notice they seem to get stripped out after saving).  I've played around with a display template, but it seems to no longer be used after I do a "save changes".  I've Does anyone have a suggestion on how to handle this situation?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Oct 2011, 09:54 AM
Hello Finallyinseattle,

You need to use a <pre> element in order to enable new line display. This can be done using a template. Here is an example:

columns.Bound(o => o.Notes)
 // template used for server binding
 .Template(o =>
{
 %>
   <pre><%= o.Notes %></pre>
 <%
})
 // template used for ajax binding
.ClientTemplate("<pre><#= Notes #></pre>");


Kind regards,

Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Grid
Asked by
FinallyInSeattle
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or