Your search did not match any results.
Form

Customize Item

Documentation
The Form widget can create form items automatically for each field of the formData object. If you’d prefer to configure form items manually, pass the required array of configuration objects to the items option. You can specify the name of the bound data field, editor type, editor configuration, validation options (etc.) for each form item.
<div class="long-title"><h3>Employee Details</h3></div> <div id="form-container"> @(Html.DevExtreme().Form() .ID("form") .ColCount(2) .Items(items => { items.AddSimple() .DataField("ID"); items.AddSimple() .DataField("FirstName") .Editor(e => e .TextBox() .Disabled(true) ); items.AddSimple() .DataField("LastName") .Editor(e => e .TextBox() .Disabled(true) ); items.AddSimple() .DataField("Position") .Editor(e => e .SelectBox() .DataSource(new string[] { "HR Manager", "IT Manager", "Controller", "Sales Manager", "Support Manager", "Shipping Manager" } ) .Value("") ) .ValidationRules(r => r .AddRequired() .Message("Position is required") ); items.AddSimple() .DataField("BirthDate") .Editor(e => e .DateBox() .Disabled(true) ); items.AddSimple() .DataField("HireDate") .Editor(e => e .DateBox() .Value(new JS("null")) ) .ValidationRules(r => r .AddRequired() .Message("Hire date is required") ); items.AddSimple() .ColSpan(2) .DataField("Notes") .Editor(e => e .TextArea() .Height(90) ); items.AddSimple() .DataField("Address"); items.AddSimple() .DataField("Phone") .Editor(e => e .TextBox() .Mask("+1 (X00) 000-0000") .MaskRules(new { X = new JS("/[02-9]/") }) ); }) .OnContentReady(@<text> function(e) { e.component.validate(); } </text>) .FormData(Model.FormData) ) </div>
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.MVC.Demos.Models; using DevExtreme.MVC.Demos.Models.SampleData; using DevExtreme.MVC.Demos.ViewModels; using Newtonsoft.Json; using System; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class FormController : Controller { public ActionResult CustomizeItem() { return View(new FormViewModel { FormData = new Employee { ID = 1, FirstName = "John", LastName = "Heart", Phone = "360-684-1334", Position = "CEO", BirthDate = DateTime.Parse("1964/03/16"), HireDate = DateTime.Parse("1995/01/15"), Notes = "John has been in the Audio/Video industry since 1990. He has led DevAv as its CEO since 2003.\r\n\r\nWhen not working hard as the CEO, John loves to golf and bowl. He once bowled a perfect game of 300.", Address = "351 S Hill St., Los Angeles, CA" } }); } } }
#form-container { margin: 10px; } #button { float: right; margin-top: 20px; } .long-title h3 { font-family: 'Segoe UI Light', 'Helvetica Neue Light', 'Segoe UI', 'Helvetica Neue', 'Trebuchet MS', Verdana; font-weight: 200; font-size: 28px; text-align: center; margin-bottom: 20px; }