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

2 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Jul 2013

    Posted 15 Oct 2016 Link to this post


    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

  2. Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 18 Oct 2016 Link to this post

    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
Back to Top