@using NorthwindWebClient.Models
@using Telerik.Web.Mvc.UI
@model IQueryable<ComplexProduct>
@{
    ViewBag.Title = "About Us";
}

<h2>Using a Complex Object as Model</h2>
<h4>Issue: Cannot sort columns when using a custom model, comprising of two or more entities.</h4>
<p>Steps to Reproduce</p>
<p>
   Try sorting a column. If you inspect the response, you'll find the following error:<br /><br />
   <pre>The orderby query option cannot be specified after the select query option.</pre><br /><br />
   
</p>
@{Html.Telerik().Grid<ComplexProduct>()
      .Name("ProductsGrid")
      .DataKeys(c => c.Add(e => e.ProductId))
      .DataBinding(db => db.Ajax().Select("GetAllProducts", "Home"))
      .Columns(columns =>
                   {
                       columns.Bound(e => e.ProductName);
                       columns.Bound(e => e.SupplierName);
                   }).Pageable(page => page.PageSize(10)).Sortable().Render(); }