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

[Solved] InCell editing Masked Input

1 Answer 235 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 25 Jan 2015, 03:47 AM
We would like to use incell editing and a masked phone no. MVC 5 application

I have tried this:  

telephone.cshtml
@using Kendo.Mvc.UI
@model string
 
@(Html.Kendo().MaskedTextBoxFor(m=>m).Mask("(000) 000-0000"))



Model
public class ResidentVm
    {
        public Guid ResidentId { get; set; }
        [Required]
        public string FirstName { get; set; }
        [Required]
        public string LastName { get; set; }
        [Required]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }
        [Required]
        [DataType(DataType.PhoneNumber)]
        [UIHint("Telephone")]
        public string Phone { get; set; }
        [Display(Name = "DOB")]
        [Required]
        [UIHint("Date")]
        public DateTime DOB { get; set; }
    }


gridview.cshtml
@(Html.Kendo().Grid<ResidentVm>()
          .Name("ResidentsGrid")
          .Columns(c => {
                            c.Bound(r => r.ResidentId).Hidden();
                            c.Bound(r => r.FirstName);
                            c.Bound(r => r.LastName);
                            c.Bound(r => r.Phone).EditorTemplateName("telephone");
                            c.Bound(r => r.Email);
                            c.Bound(r => r.DOB).Format("{0:d}").EditorTemplateName("Date");
          })
          .Editable(editable => editable.Mode(GridEditMode.InCell))
        .ToolBar(toolBar => toolBar.Create())
                         
          .Pageable()
          .Sortable()
          .Scrollable()
          .HtmlAttributes(new { style = "height:230px; margin-bottom:20px" })
          .DataSource(dataSource => dataSource
              .Ajax()
              .Batch(true)
              .ServerOperation(false)
              .PageSize(20)
              .Events(events => events.Error("error_handler"))
              .Model(m =>
                {
                    m.Id(em => em.ResidentId);
                    m.Field(p => p.ResidentId).Editable(false);
 
                })
               
               
              .Create(update => update.Action("CreateResidents", "AuthorizationExemption"))
              .Read(read => read.Action("GetResidents", "AuthorizationExemption"))
              .Update(update => update.Action("EditingInline_Update", "AuthorizationExemption"))
              .Destroy(update => update.Action("EditingInline_Destroy", "AuthorizationExemption"))
          )
          )


However, this does not work :(

Please help


1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 28 Jan 2015, 07:35 AM
Hello Bob,

I'm afraid that I'm unable to re-create such behavior locally. Please take a look at that attached project, maybe I'm missing something obvious.

Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or