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

How to fill the grid columns with list items.

0 Answers 46 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Balakrishna
Top achievements
Rank 1
Balakrishna asked on 20 Nov 2012, 01:35 PM
Hi,

I am filling the grid with List of model objet,Inside that each model object again i will be having a list of other model object ,i want show few columns in the grid by using the list which is inside the main Model.

Because of the below foreach i am getting the error.

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(ViewModel => ViewModel.name).Title("name");
foreach (var sec in Model)
{
for (int i = 0; i < sec.SecurityIdentifierModel.Count; i++)
{
string columnName = sec.SecurityIdentifierModel[i].IdentifierType;
columns.Bound(securityViewModel => securityViewModel.SecurityIdentifierModel[i].Identifier).Title(columnName);
}
}
})
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(o => o.Identifier)))
)

Thanks in advance...

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Balakrishna
Top achievements
Rank 1
Share this question
or