This is a migrated thread and some comments may be shown as answers.

Kendo MVC Editable Grid - Numeric TextBox Not working

1 Answer 686 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aarti
Top achievements
Rank 1
Aarti asked on 30 Mar 2015, 10:25 PM
Hi,

I have Kendo MVC editable Grid  with Custom EditorTemplate for Numeric Text Box. For some reason I am getting validation error icon when i  try to update the value in numeric text box as in attached file.

I am not sure what kind of validation it is triggering as I have only required field validation. Can you pelase help me ASAP on this.


My model is as below

[Serializable]
    public class DocTypesModel
    {
        [Required(ErrorMessage = "required")]
        [UIHint("NumericTextBoxWithLimitsTemplate")]
        public int Order { get; set; }

        public int TotalCount { get; set; }

        public string DocumentTypeShortName { get; set; }      

    }

My grid is as below


 @(Html.Kendo().Grid(Model.DocTypesModel)
                      .Name("BookmarkDoctypeGrid")
                   
                     .Columns(columns =>
                      {
                            columns.Bound(c => c.Order).Sortable(false).EditorTemplateName("NumericTextBoxWithLimitsTemplate");
                          columns.Bound(c => c.DocumentTypeShortName).Title("Document Type").Sortable(false);
                        
                      })
                      .Editable(e => e.Mode(GridEditMode.InCell))
                      .Sortable()
                      .Events(e => e.DataBound("OnGridDocTypeDataBound").SaveChanges("SaveDocTypeChanges"))
                      .Resizable(resiz => resiz.Columns(false))
                      .DataSource( dataSource =>
                          dataSource.Ajax()
                           .AutoSync(true)
                           .ServerOperation(false)
                          .Update("Editing_Update", "Bookmark")
                              .Events(events => events.Error("error_handler"))
                        
                      )
                      )

I have created below custom editor for  NumericTextBoxWithLimitsTemplate under /views/shared/EditorTemplates/NumericTextBoxWithLimitsTemplate.cshtml

@model int

@(Html.Kendo()
.NumericTextBox().Step(1)
    .Name("Order").Decimals(0)
    .HtmlAttributes(new { Style = "width:70px;", required="required"})
         .Min(1).Max(short.MaxValue)
         
      

Thanks,
AArti



1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 01 Apr 2015, 02:20 PM

Hello Aarti,

Could you please try using NumercTextBoxFor as shown below:

 

@(Html.Kendo().NumericTextBoxFor(m => m)
)

 

Regards,
Boyan Dimitrov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
Aarti
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or