Reputation: 6587
I am working for a project with MVC4.
I am using kendo editor template for Incell
Editing. Here is a column that is accepting negative value when edited.
Code I am using-
@(Html.Kendo().Grid<Dev.Crm.Web.Models.ViewModel.ProjectViewModel>()
.Name("_projectGrid")
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Columns(columns =>
{
columns.Bound(p => p.FixedPrice).Title(@Dev.Crm.Web.Resources.Shared.Project.Label_FixedPrice).EditorViewData(new { OnChangeCallback = "Product_List_updateProjectChanges" }).Width("15%").EditorTemplateName("Number");
})
.Pageable()
.Sortable()
.Selectable()
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>model.Id(p => p.TaskID))
.Batch(true)
.Model(model =>
{
model.Id(p => p.ProjectID);
model.Field(p => p.ProjectID).Editable(false);
})
.Read(read => read.Url(@Url.Project_Operation_Read()).Data("Project_List_searchData"))// the name of the javascript function which will return the additional data.
//.Destroy(destroy => destroy.Action("Delete", "Project"))
.Update(update => update.Url(@Url.Project_Operation_SaveCellEdit()))
)
.Events(e => { e.DataBound("Grid_DataBound"); })
)
In cell edit , I can edit this cell, but how do i restrict it from accepting negative values.
Upvotes: 0
Views: 1645
Reputation: 20203
Basically I assume that your project has the EditorTemplates under the Shared/EditorTemplate folder. If you have them then for numbers you should use the KendoNumericTextBox widget.
If you do not use the Kendo NumbericTextBox as editor - you better find how to do it.
Once you have that editor template applied you can set the Min option to be equal to 0.
Upvotes: 1