This question is locked. New answers and comments are not allowed.
Hello,
I have a grid I would like to populate via ajax that can have a variable number of columns.
For instance, the first call may return an object that has a dictionary with 5 records so my grid would need to have 6 columns, the second time the dictionary will have 8 records so my grid will have 9 columns.
Is this possible?
This is what I've tried, but none of the columns get populated:
This is what my Table object looks like:
So what I need is to have Counts.Count + 1 number of columns and populate the columns with the Name value as well as the Values of each dictionary entry - I can change the Dictionary to a List if that would make it easier to work with.
Thanks,
I have a grid I would like to populate via ajax that can have a variable number of columns.
For instance, the first call may return an object that has a dictionary with 5 records so my grid would need to have 6 columns, the second time the dictionary will have 8 records so my grid will have 9 columns.
Is this possible?
This is what I've tried, but none of the columns get populated:
@(Html.Telerik().Grid<Table>().Name("Grid").Columns(columns =>{columns.Bound(e => e.Name).Title("Object name").Width(350);for (var i = 0; i < e.Counts.length; i++){columns.Bound(e => e.Counts.ElementAt(i).Value);}}).Footer(false)This is what my Table object looks like:
public class Table { public String Name { get; set; } public Dictionary<String, Int64> Counts { get; set; } }So what I need is to have Counts.Count + 1 number of columns and populate the columns with the Name value as well as the Values of each dictionary entry - I can change the Dictionary to a List if that would make it easier to work with.
Thanks,