0
votes

I have one grid that have two fields called minimum and maximum.

@(Html.Kendo().Grid<FS.ERP.CMVC.Models.LeavePolicyDetailViewModel>()
 .Name("gridExample")
 .Columns(columns =>
 {

  columns.Bound(p => p.Minimum).Width(100).HtmlAttributes(new { id = "minimum"});
  columns.Bound(p => p.Maximum).Width(100).HtmlAttributes(new { id = "maximum"});                                                                                                                         
  })
 .ToolBar(toolBar =>
  {
     toolBar.Create();
  })
 .Editable(editable => editable.Mode(GridEditMode.InCell))
 .Pageable()
 .Sortable()
 .Scrollable()
 .HtmlAttributes(new { style = "height:550px;" })
 .DataSource(dataSource => dataSource.Ajax()
                                     .Batch(true)
                                     .ServerOperation(false)                                                    
                                     .PageSize(20)                                                
                                            )                                         
                                            ) 

I want my values to writen in the minimum maximum range. If the user writes value in minimum cell first then Maximum must be greater than it and If user writes in maximum first then minimum should always b less then maximum.

Any help would be appreciated!

1

1 Answers

0
votes

On save command in kendo grid, you can achieve this functionality. Attach save event in your kendo grid like this,

save : function (e) {
    //access both min and max value
    alert(e.values.maximum);
    alert(e.values.minimum)

    //your logic- do whater you want
    e.model.set("minimum", some value);
    }
}