Hi, I have been working on putting a wrapper around the grid, so that based on certain values that are set, the grid can then be generated server side and returned. Below is an example of the model used to set the values and the function used to generate the grid. I was wondering if there was a way to use the string of a client template to set a column template value?
Example:
public class GridModelExample
{
private List<ColumnDefinition> _Columns = new List<ColumnDefinition>();
public List<ColumnDefinition> Columns
{
get { return _Columns; }
set { _Columns = value; }
}
public GridModel GetData()
{
…
}
.
.
.
}
public class ColumnDefinition
{
private string _Name = “name of column”;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
private string _ClientTemplate = “string value for client template”;
public string ClientTemplate
{
get { return _ ClientTemplate; }
set { _ ClientTemplate = value; }
}
}
public functionToGenerateGrid(GridModeExample)
{
_GridBuilder = Telerik.Web.Mvc.UI.HtmlHelperExtension.Telerik(helper).Grid<T>()
.Name(Grid.Name)
.EnableCustomBinding(true)
.BindTo(Grid.GetData());
foreach (ColumnDefinition column in GridModelExample.Columns)
{
_GridBuilder = _GridBuilder.Columns(col =>
{
GridBoundColumnBuilder<T> columnBoundBuilder = col
.Bound(column.Name)
.ClientTemplate(column.ClientTemplate);
//want to add:
// columnBoundBuilder = columnBoundBuilder
// .Template(set from client template);
});
}
}