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

How to create MVC Grid with variable number of columns by referencing model IEnumerable property

1 Answer 280 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 15 Oct 2016, 08:44 AM

Hi

I'm trying to create a grid with a variable number of columns using the MVC Grid component referencing the following (simplified) model:-

public class GridModel
{
     public int Id { get; set; }
     public string Name { get; set; }
     public List<int> Values { get; set; }
}

Using the AutoGenerate option of the column configuration only seems to create columns for the Id & Name model properties, but not the Values enumerable.

I can't find an obvious way to achieve this; could you provide some help please?

Thanks in Advance

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 18 Oct 2016, 01:11 PM
Hello Michael,

As discussed in the support ticket that you have opened with the same question, using the auto-generated columns mechanism is not applicable in such scenario and you will have to manually create the columns in a similar to the used in the following example approach:
If further questions arise I would suggest that we continue the communication in the support ticket.


Best Regards,
Konstantin Dikov
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Michael
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or