2013-03-07 68 views
0

我正在为MVC4项目工作。Kendo编辑器,负值限制

我正在使用剑道编辑器模板Incell编辑。这是一个在编辑时接受负值的列。

代码我使用 -

@(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"); }) 

    ) 

在单元格编辑,我可以编辑该单元格,但如何限制其接受负值。

回答

1

基本上我假设你的项目有Shared/EditorTemplate文件夹下的EditorTemplates。如果你有他们,那么你应该使用KendoNumericTextBox小部件。

如果不使用剑道NumbericTextBox作为编辑 - 你最好find how to do it.

一旦你的模板编辑器应用可以设置Min选项等于0