@bobnoordam

DevExpress DateEdit (Date Picker) model binding in MVC

This is the absolute minimum you need to use model binding with the DevExpress date picker control. The important part is that the name setting on the control must be the same as the field name you use to store the picked value in.

ViewModel

using System;

namespace DXWebSample.ViewModels {
    public class DemoViewModel {
        public DateTime PickedValue { get; set; }
    }
}

View

@model DXWebSample.ViewModels.DemoViewModel
<h2>Date Picker demo</h2>
@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary()
    <p>
        DevExpress date picker model binding, make sure the name
        of the picker and the property on the model match.
    </p>
    @Html.DevExpress().DateEdit(
        settings => {
            settings.Name = "pickedValue";
        }
    ).Bind(Model.PickedValue).GetHtml()
    if (!string.IsNullOrWhiteSpace(ViewBag.Message)) {
        <h2>
            @ViewBag.Message
        </h2>
    }
    <input type="submit" value="update"/>
}

Controller

using System;
using System.Web.Mvc;
using DXWebSample.ViewModels;

namespace DXWebSample.Controllers {
    public class HomeController : Controller {
        #region Methods

        // GET: Home
        public ActionResult Index() {
            DemoViewModel model = new DemoViewModel {
                PickedValue = DateTime.Now.Date
            };
            return View(model);
        }

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index(DemoViewModel model) {
            ViewBag.Message = model.PickedValue.ToString();
            return View(model);
        }

        #endregion
    }
}