Function Title(), ClientTemplate() and encode(false) don't work when I bind dynamic columns in a hierarchy grid.
Some columns contains html like <br/>. I tried Encode(false), but it doesn't work.
View:
@(
Html.Kendo().Grid<dynamic>().Name("Grid")
.DataSource(ds => ds.Ajax()
.Model(m =>
{
foreach (System.Data.DataColumn column in Model.AssessmentData.Columns)
{
m.Field(column.ColumnName, column.DataType);
}
})
.Read(r => r.Action("GetStudentResult", "StudentDetail",
new { studentID = "#=StudentID#", headerID = "#=HeaderID#" }))
)
.Name("grid_#=HeaderID#")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.AssessmentData.Columns)
{
var c = columns.Bound(column.ColumnName);
c.Title(column.ColumnName + "_test");
c.ClientTemplate("<div class='test'>#:" + column.ColumnName + "#</div>");
}
})
.Sortable()
.ToClientTemplate()
)
Controller:
public ActionResult GetStudentResult([DataSourceRequest] DataSourceRequest request,
int studentID, int headerID)
{
DataTable dt = this.core.GetAssessResult(studentID, headerID,
this._loginInfo.SchoolID);
string test = JsonConvert.SerializeObject(dt.ToDataSourceResult(request));
return Content(test, "application/json");
}