Kendo網格中可以使用Kendo MaskedTextBox嗎?如果是這樣,怎麼樣?KendoGrid內部的MaskedTextBox
我正在使用MaskedTextBox的編輯器模板。
@model object
@Html.Kendo().MaskedTextBoxFor(m => m).Mask("(000) 000-0000")
Kendo網格有一個電話字段,它使用MaskedTextBox,但它不抓住掩碼。
@(Html.Kendo().Grid(new ContactViewModel[] { })
.Name("ServiceLocationContactsGrid")
.Columns(column =>
{
column.ForeignKey(c => c.ContactTypeId, (System.Collections.IEnumerable)ViewData["contactTypes"], "ContactTypeId", "Description").EditorTemplateName("GridForeignKey");
column.Bound(c => c.LastName).Width(700);
column.Bound(c => c.FirstName);
column.Bound(c => c.Title);
column.Bound(c => c.EmailAddress);
column.Bound(c => c.TelephoneNumber).EditorTemplateName("Telephone");
column.Bound(c => c.TelephoneExtension);
column.Bound(c => c.FaxNumber).EditorTemplateName("String");
column.Command(command => { command.Edit().Text(" ").UpdateText(" ").CancelText(" "); command.Destroy().Text(" "); }).Width(180).Visible(!ViewBag.ReadOnlyView);
})
.ToolBar(toolBar =>
{
if(!ViewBag.ReadOnlyView) toolBar.Create().Text("Add New Contact");
})
.Sortable()
.Filterable()
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource =>
dataSource
.Ajax()
.ServerOperation(false)
.Model(model =>
{
model.Id(c => c.ContactId);
model.Field(c => c.ContactId).Editable(false);
})
.Create(create => create.Action("CreateContact", "Contact"))
.Update(update => update.Action("UpdateContact", "Contact"))
.Read(read => read.Action("ListContacts", "Contact"))
.Destroy(destroy => destroy.Action("DestroyContact", "Contact"))
)
)
很高興幫助你:) –