2016-06-16 192 views
-1

DataSourceResult不包含ToDataSourceResult的定義和最佳推廣方法重載QueryableExtensions.ToDataSourceResult(DataTable, DataSourceRequest)需要類型的接收器DataTable填寫劍道UI電網

var results = db.Accounts.ToDataSourceResult(
    request, 
    o => new { 
     ID = o.ID, 
     AccCode = o.AccCode, 
     AccName = o.AccName, 
     Phone = o.Phone, 
     Email = o.Email, 
     DateBirth = o.DateBirth, 
     Address = o.Address, 
     Type = o.Type 
    } 
); 

return Json(results.ToDataSourceResult(request), JsonRequestBehavior.AllowGet); 
+0

@(Html.Kendo()網格() 請將.Name( 「客戶端」) –

+0

公共類AccountsViewModel { 公共長ID {得到;集;} 衆長AccCode {獲取;集;}? [StringLength(50)] 公共字符串AccName {獲得;設置;} [StringLength(50)] 公共字符串電話{獲取;集;} [StringLength (50)] 公共條例g電子郵件{get;組; } [StringLength(50)] public string DateBirth {get;組; } [StringLength(50)] public string Address {get;組; } public int? OfferID {get;組; } public int?類型{get;組; } –

回答

0

您的結果var爲已經一個DataSourceResult所以你不必在Json()中再次做到這一點。