This question is locked. New answers and comments are not allowed.
So, I'm trying to do something like what I have below and can't seem to get it working. I'm just wondering if it is even possible to set up a grid like this without knowing the properties of the model in advance?
@(Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.GetType().GetProperties().First(p => p.HasAttribute<GroupableAttribute>()).Name).Hidden();
foreach(PropertyInfo prop in Model.GetType().GetProperties().Where(p => !(p.HasAttribute<GroupableAttribute>())).Select(p => p))
{
columns.Bound(prop.Name);
}
})
.Groupable(settings => settings.Groups(g => g.Add(o => o.GetType().GetProperties().First(p => p.HasAttribute<GroupableAttribute>()).Name)))
.Sortable()
.Filterable()
)
@(Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.GetType().GetProperties().First(p => p.HasAttribute<GroupableAttribute>()).Name).Hidden();
foreach(PropertyInfo prop in Model.GetType().GetProperties().Where(p => !(p.HasAttribute<GroupableAttribute>())).Select(p => p))
{
columns.Bound(prop.Name);
}
})
.Groupable(settings => settings.Groups(g => g.Add(o => o.GetType().GetProperties().First(p => p.HasAttribute<GroupableAttribute>()).Name)))
.Sortable()
.Filterable()
)