Reputation: 2553
My scenario is , I've controller which is passing ViewModel Object to view .
For one model we can return json array from controller . but what for multiple objects case like ViewModel And the thing is that for each list (In my viewmodel object) i need to make a seperate Grid . Any help will be appreciated .
Upvotes: 1
Views: 1780
Reputation: 2553
I got the answer of my own question . we can make grid using viewmodel object which further includes multiple objects simply by doing the following code:
@(Html.Kendo().Grid(Model.accountHistory).Name("Account_History").Columns())
Upvotes: 1
Reputation: 3301
I have done it like this before - in your javascript, you can generate a kendo datasource from the object in your viewmodel:
var yourDataSource = new kendo.data.DataSource({ data: @Html.Raw(Json.Encode(Model.SomeObject)) });
yourDataSource.read();
More often than not though, I wire the up to a service so the loading of the data can by asynchronous, etc...
Upvotes: 1