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

Using viewmodelpage in read action

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Houssem
Top achievements
Rank 1
Houssem asked on 03 Sep 2015, 01:44 PM

Hello,

I need to use my viewmodelpage in my read action of kendo mvc grid. This my codes :

#Controller

 VolViewModel model;

public ActionResult Index()
{
model = new VolViewModel { Item = new List<Vol>() };
model.Item = _volBusiness.GetAllVol();
return View(model);
}

[System.Web.Mvc.AcceptVerbs(HttpVerbs.Post)]
public ActionResult Read([DataSourceRequest]DataSourceRequest request)
{
var result = model.Item;
return Json(result.ToDataSourceResult(request));
}

 

#Index.cshtml

.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(15)
.Model(model =>
{
model.Id(m => m.VolId);
})
.Read(read => read.Action("Read", "Vol")
)

 

Thanks,

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 07 Sep 2015, 08:46 AM
Hello Houssem,

Note that you should specify the exact name of the action and the controller. Check out the following article for illustration:


Regards,
Viktor Tachev
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Houssem
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or