Current filter:
                                You should refresh the page.
                                Support Center
                                  • I have an Html.BeginForm that has several controls such as Html.DropDownListFor and HtmlTextBoxFor to collect information for creating a new user.

                                    I want to use the DevEx DateEdit control instead of a simple TextBoxFor but how do I bind it to one of the strongly typed model properties? Nice would be a "DateEditFor" extension...Thx for some ideas!

                                    Here is an example of what I have.

                                    @model Public.Models.SiteMember

                                    @using (Html.BeginForm())



                                    <p>Your first name: @Html.TextBoxFor(x => x.FirstName) </p>

                                    <p>Your last name: @Html.TextBoxFor(x => x.LastName) </p>

                                    @*<p>Your date of birth: @Html.TextBoxFor(x => x.DOB)</p>*@

                                    <p>Your date of birth: </p>

                                    @Html.DevExpress().DateEdit( <<<--- how do I bind the selected data to my model so it can be submitted???

                                    settings => {

                                    settings.Name = "dobEdit";

                                    settings.Properties.DisplayFormatString = "D";

                                    settings.Date = DateTime.Now;


                                    <p>Your Address: @Html.TextBoxFor(x => x.Address)</p>

                                    <p>Your City: @Html.TextBoxFor(x => x.City)</p>

                                    <p>Your State: @Html.TextBoxFor(x => x.State)</p>

                                    <p>Your Zip Code: @Html.TextBoxFor(x => x.Zipcode)</p>

                                    <input type="submit" value="Create Member" />


                                • Blaine Perry 1 11.09.2012

                                  I found the data binding method so I changed ".GetHtml()" to ".Bind(Model, "DOB").GetHtml()" and now I get one way binding in that the supplied date is shown, but when posting back, I get all my model data except DOB which has the default 01/01/0100 date so apparently was not set even though the rest of the SiteMember model properties were set. Also, I can't get the date picker to show - all I see is a text box with the date in the model supplied to the view.

                                • Blaine Perry 1 11.09.2012

                                  Got the calendar to work. Found that the DevEx project update tool did not add any styles to the _Layout master view.

                                  So just need to figure out how to do two way binding where the DateEdit control will update the DOB property in the model object to send to the postback. All the other controls update the model Ok.

                                • Blaine Perry 1 11.10.2012

                                  Actually since strong typed, I changed to ".Bind(Model.DOB).GetHtml()" but am still getting only 1 way binding in that the initial date is set according to the model, but I do not get the date posted back. Everything else in the Html.Begin form posts back. Just not the date.

                                          <p>Your date of birth: </p>
                                              settings => {
                                              settings.Name = "DobEdit";
                                              settings.Date = Model.DOB; <- this works from model to view
                                              settings.Properties.UseMaskBehavior = true;
                                              settings.Properties.NullText = "MM/dd/yyyy";
                                              settings.Properties.EditFormat = EditFormat.Custom;
                                              settings.Properties.DisplayFormatString = "MM/dd/yyyy";
                                              settings.Properties.EditFormatString = "MM/dd/yyyy";
                                          }).Bind(Model.DOB).GetHtml() <- but view to model does not work on postback

                                • Blaine Perry 1 11.10.2012

                                  I read I was supposed to use the special DevEx binder so added the below to the controller postback action but unfortunatley it still did not help. DOB is still not coming back from the DateEdit control.

                                  public ActionResult Member([ModelBinder(typeof(DevExpressEditorsBinder))] SiteMember pNewMember) // use DevExpress model binding so can get the date!

                                3 Solutions

                                Creation Date Rating Importance Sort by
                                Hi guys I found a working solution.

                                All I had to do was set the name as the model property.

                                Then I got the value show up in my controller.

                                From this:
                                @Html.DevExpress().DateEditFor(model => model.BirthDate,   settings => {
                                       settings.Name = "_birthDate";        settings.Properties.DisplayFormatString = "D";   }).GetHtml()

                                To this:
                                @Html.DevExpress().DateEditFor(model => model.BirthDate,   settings => {
                                       settings.Name = "BirthDate";        settings.Properties.DisplayFormatString = "D";   }).GetHtml()
                                • Lanette (DevExpress Support) 05.18.2015

                                  Thank you for sharing your code. I believe it will help other customers.

                                Ok the name of the DateEdit control had to be DOB!!! This was not clear in the doc. And seems redundant since sort of already bound in two other places (i.e. the Date property and the Bind argument. Anyway it's working now.


                                Hello David,

                                At present, our Editors do not provide the capability to use the EditorFor syntax.
                                Please refer to the Q341608 - Editors - Add a method that allows the use of lambda expressions to bind an editor report for more information.

                                When using Model binding, make sure that you set:
                                - The Editor's Name property equal to the corresponding Model field;
                                - Use the DevExpressEditorsBinder in the corresponding Controller Post Action.

                                @Html.DevExpress().DateEdit(settings => { settings.Name = MODEL_PROPERTY_HERE; })Bind(Model.MODEL_PROPERTY_HERE).GetHtml()

                                Take a look at the online Data Editors - Model Validation demo to see this approach in action.

                                • ranjith nanjala 10.07.2014

                                  I am not able to read the value of date from the dev ex DateEdit control in the controller when i click submit.

                                  I tried
                                  @Html.DevExpress().DateEdit(settings => {
                                     settings.Name = MODEL_PROPERTY_HERE;

                                  @Html.DevExpress().DateEditFor(model => model.BirthDate,
                                     settings => {
                                         settings.Properties.DisplayFormatString = "D";

                                  I am getting null value in the controller

                                • Lanette (DevExpress Support) 10.07.2014


                                  To process your recent post more efficiently, I created a separate ticket on your behalf: T158742: GridView - Unable to read a date value from DateEdit in the controller. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners