This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Template

0 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jerry
Top achievements
Rank 1
Jerry asked on 27 Jun 2012, 06:06 PM
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()
)
Tags
Grid
Asked by
Jerry
Top achievements
Rank 1
Share this question
or