This question is locked. New answers and comments are not allowed.
I have a view which the user puts together themselfs. So my view model looks something like this:
public class DynamicListViewModel
{
public DynamicListViewModel()
{
DyanmicViewModels = new List<DynamicViewModel> {new DynamicViewModel()};
}
public IList<DynamicViewModel> DyanmicViewModels { get; set; }
}
public class DynamicViewModel
{
public DynamicViewModel()
{
ColumnValues = new Dictionary<string, string> {{"Key1", "Value1"}, {"Key2", "Value2"}, {"Key3", "Value3"}};
}
public IDictionary<string, string> ColumnValues { get; set; }
}
My question is how do ii build up a grid that takes advantage of sortting, paging, filtering etc. I do not have columns which i can bind to.
Any assisstance would be appreciated.
public class DynamicListViewModel
{
public DynamicListViewModel()
{
DyanmicViewModels = new List<DynamicViewModel> {new DynamicViewModel()};
}
public IList<DynamicViewModel> DyanmicViewModels { get; set; }
}
public class DynamicViewModel
{
public DynamicViewModel()
{
ColumnValues = new Dictionary<string, string> {{"Key1", "Value1"}, {"Key2", "Value2"}, {"Key3", "Value3"}};
}
public IDictionary<string, string> ColumnValues { get; set; }
}
My question is how do ii build up a grid that takes advantage of sortting, paging, filtering etc. I do not have columns which i can bind to.
Any assisstance would be appreciated.
5 Answers, 1 is accepted
0
Hi Thomas,
You can use autogenerated columns:
http://demos.telerik.com/aspnet-mvc/grid/autogeneratecolumns
All the best,
Dimo
the Telerik team
You can use autogenerated columns:
http://demos.telerik.com/aspnet-mvc/grid/autogeneratecolumns
All the best,
Dimo
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0
thomas
Top achievements
Rank 1
answered on 14 Jun 2011, 07:48 AM
Hi,
Thank for you for the quick response, however i don't understand how autogenerated columns will help me in this case. Could you provide a sample please?
Also could you explain the difference between using AutoGenerated columns and me building up a dataview and using that as the Grids datasource.
Cheers,
Thomas
Thank for you for the quick response, however i don't understand how autogenerated columns will help me in this case. Could you provide a sample please?
Also could you explain the difference between using AutoGenerated columns and me building up a dataview and using that as the Grids datasource.
Cheers,
Thomas
0
Hi thomas,
Atanas Korchev
the Telerik team
If you don't specify the columns the grid will create a column for every public property of the model which is bindable (of primitive type).
The autogenerated columns example is the only one which we currently have. You can just try binding the grid without setting the columns and see how it goes from there.
Atanas Korchev
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0
thomas
Top achievements
Rank 1
answered on 14 Jun 2011, 11:40 AM
public class DynamicListViewModel
{
public DynamicListViewModel()
{
DyanmicViewModels = new List<DynamicViewModel> {new DynamicViewModel()};
}
public IList<DynamicViewModel> DyanmicViewModels { get; set; }
}
public class DynamicViewModel
{
public DynamicViewModel()
{
ColumnValues = new Dictionary<string, string> {{"Key1", "Value1"}, {"Key2", "Value2"}, {"Key3", "Value3"}};
}
public IDictionary<string, string> ColumnValues { get; set; }
}
The Grid will be trying to auto generate a column for DyanmicViewModels which is not a primitive type. So i don't understand how the AutoGenerate feature helps me in this case.
{
public DynamicListViewModel()
{
DyanmicViewModels = new List<DynamicViewModel> {new DynamicViewModel()};
}
public IList<DynamicViewModel> DyanmicViewModels { get; set; }
}
public class DynamicViewModel
{
public DynamicViewModel()
{
ColumnValues = new Dictionary<string, string> {{"Key1", "Value1"}, {"Key2", "Value2"}, {"Key3", "Value3"}};
}
public IDictionary<string, string> ColumnValues { get; set; }
}
The Grid will be trying to auto generate a column for DyanmicViewModels which is not a primitive type. So i don't understand how the AutoGenerate feature helps me in this case.
0
Hi thomas,
Atanas Korchev
the Telerik team
Indeed the autogenerated columns will no be of help here. I am afraid the Telerik MVC Grid does not support your view model. It needs a member expression in order to get access to the bound field. This is required for sorting, filtering and grouping.
Regards,Atanas Korchev
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
