Hi,
I'm using a client row template to style my grid which is created as follows:
@(Html.Kendo().Grid<TEAMSV2.Models.JobLogNoteDTO>()
.Name(
"jobLogGrid"
)
.DataSource(datasource => datasource
.Ajax()
.Read(read =>
{
read.Action(
"GetJobLogNotes"
,
"TeamsV2"
).Type(HttpVerbs.Post);
})
.Sort(sort => sort.Add(
"DateCreated"
).Descending())
.PageSize(10)
)
.Columns(columns =>
{
columns.Bound(note => note.ItemNo).Title(
"Ref."
).Width(60);
columns.Bound(note => note.DateCreated).Title(
"Note Recorded"
).Width(110);
columns.Bound(note => note.NoteHtml).Title(
"Description"
).Encoded(
false
);
columns.Bound(note => note.Employee).Title(
"Employee"
).Width(110);
})
.HtmlAttributes(
new
{ style =
"max-height:496px; height:496px;"
})
.Scrollable()
.Sortable()
.Pageable()
.ClientRowTemplate(Html.Partial(
"JobLog/JobLogTab/JobLogNotesGridTemplate"
).ToHtmlString())
.Events(e => e.DataBound(
"JobLogNotesDatabound"
))
)
The row template is as follows:
<tr>
<td>
<a href=
"/TeamsV2/Search?search=#:data.ItemNo#"
style=
"text-decoration:underline;"
>#:data.ItemNo#</a>
</td>
<td>
#: kendo.toString(data.DateCreated, 'd MMM yyyy HH:mm')#
</td>
<td>
#: data.NoteHtml#
</td>
<td>
#: data.Employee#
<br />
<div class=
"JobLogEmployeePhoto"
data-id=
"#: data.EmployeeID#"
>
</div>
</td>
</tr>
The value of "data.NoteHtml" contains "/n" for line breaks as it was inserted via a TextArea. These /n's are not showing as line breaks in the grid. I've tried replacing them with HTML so the data contains <br> tags instead but they still do not show.
My main question is this: If I modify the data so that the string acxtually contains HTML markup for <BR> or <BR></BR> or <BR /> how can I get the client row template to treat this as HTML instead of just as a string.
I've set Encoded(false) for the column but still no joy.
Thanks,
Mark.