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

Is it possible to show all of a Model's fields in an MVC grid?

2 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Casey
Top achievements
Rank 1
Casey asked on 11 Dec 2018, 10:29 PM
I've done quite a bit of research on this, but haven't found a conclusive answer, so I'm asking here.  Is there a way to have a grid display all of the Model's fields without having to specify each of them in the Columns section (ie column.bound())?  would it be possible to do a loop for them, or something of that nature, or is there a feature of the grid that i'm not currently aware of?  Maybe something like .Coluns(columns => {columns.each(x=>columns.bound(x))}?

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 12 Dec 2018, 03:06 PM
Hello Casey,

In order to generate columns for all fields in the Model you can use the AutoGenerate option. The Columns configuration would look similar to the following:

.Columns(columns => columns.AutoGenerate(true))

Give the approach a try and let me know how it works for you.


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Casey
Top achievements
Rank 1
answered on 12 Dec 2018, 03:17 PM
This is precisely what I was looking for.  Thanks for your help Viktor
Tags
Grid
Asked by
Casey
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Casey
Top achievements
Rank 1
Share this question
or