Below is code where I am trying to create master detail grids where data is fed through list of objects. When I run it I do get master detail grids, but when I try to do sorting, filtering, paging, I lose my page and I am sent back to home page. And If I use alternate DataSource code as below I get error "Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well."
Please advice. Thanks.
My model is something like this
public partial class Invoice
{
public int InvoiceNumber{ get; set; }
..
..
public List<IvDetail> IvDetails { set; get; }
}
And here is view code.
@model IEnumerable<Portal.Models.Invoice>
@{ Html.Kendo().Grid(Model)
.Name("InvoiceGrid")
.Pageable()
.Columns(columns =>
{
columns.Bound(p => p.InvoiceNumber).Filterable(true).Title("Invoice Number");
columns.Bound(p => p.InvoiceDate).Title("Invoice Date");
columns.Bound(p => p.InvoiceTotal).Title("Invoice Total");
columns.Bound(p => p.Balance).Title("Balance");
})
.Filterable()
.Sortable()
.Navigatable()
.DataSource(dataSource => dataSource.Server().PageSize(15))
// this gives error "Cannot use only server templates in Ajax or WebService binding mode. Please specify a client template as well."
//.DataSource(datasource => datasource
// .Ajax()
// .PageSize(15)
// .ServerOperation(false)
// .Sort(sort =>
// {
// sort.Add(p => p.InvoiceNumber);
// })
// )
.DetailTemplate(
@<text>
@(Html.Kendo().Grid(item.IvDetails)
.Name("IvDetails_" + item.InvoiceNumber)
.Columns(columns =>
{
columns.Bound(o => o.ItemNumber);
columns.Bound(o => o.PartNumber);
columns.Bound(o => o.Description);
})
.DataSource(dataSource => dataSource.Server().PageSize(15))
.Pageable()
.Sortable()
.Filterable()
)
</text>
)
.Sortable()
.Render();
}