I wrote a grid helper (GridHelper.cs), it works right for all models.
This Helper has a method for rendering each row as below :
private void RenderRow(HtmlTextWriter writer, T item)
{
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
foreach (var col in _columns)
{
writer.RenderBeginTag(HtmlTextWriterTag.Td);
var value = typeof(T).GetProperty(col.FieldName).GetValue(item, null) ?? String.Empty;
writer.Write(value.ToString());
writer.RenderEndTag();
}
writer.RenderEndTag();
}
Also I have some DisplayTemplates in Folder: /Views/Shared/DisplayTemplates
Such as Boolean, Date, etc.
How can I change line writer.Write(value.ToString()); to using that templates?
or what changes is needed for this line to enable the use of display templates in my grid cells?
Use this sample for that problem