0

當我插入新記錄時,如何訪問網格的現有行?如何使用ASP.NET MVC訪問Kendo UI Grid中的行

我有一個典型的基於CRUD的網格,我可以編輯3列 - 名稱,標題,薪金。
當我插入或更新記錄時,我想從現有行中訪問'Salary'數據 - 行[Salary]。

如果平均'工資'低於某個值,我不希望插入/更新成功。
看着從劍道UI示例代碼,我想在ActionMethod

在指數剃鬚刀頁面來實現這一目標:

.Create(create => create.Action("EditingCustom_Create", "Grid")) 
.Update(update => update.Action("EditingCustom_Update", "Grid")) 

在GridController的EditingCustom_Create ActionMethod:

[AcceptVerbs(HttpVerbs.Post)] 
public ActionResult EditingCustom_Create([DataSourceRequest] DataSourceRequest request, 
      [Bind(Prefix = "models")]IEnumerable<ClientViewModel> client) 
{ 

    // I want to access the Salary values from each row here 
    // and get the Average to see if it's below/above a certain 
    // value before inserting/updating a record 

    var results = new List<ClientViewModel>(); 
    ... 
    ... 
    return Json(results.ToDataSourceResult(request, ModelState)); 
} 

我該怎麼做?

http://demos.kendoui.com/web/grid/editing-custom.html

+1

如果你這樣做是批處理模式,有一個樣品劍道的UI演示站點http://demos.kendoui.c​​om/web/ grid/editing.html演示瞭如何訪問批處理模式更新中的項目。看看批處理編輯部分。 –

回答

0

編輯在批處理模式下可作爲由於處理法的溶液接收IEnumerable<..> - 其可以遍歷。

demos.kendoui.c​​om/web/grid/editing.html