Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
190
Bind DatePicker MVC3
posted

Hi,

I need to bind model data to DatePicker control in ASP.NET MVC3 application.

In the examples I dont' find anything about this.

Could anyone help me?

Thank you in advance.

Mirko

Parents
No Data
Reply
  • 640
    posted

    Hi Mirko,

    Thank you for your interest in our new jQuery product.

    You can look at Editors -> Order Entry Form Sample at http://samples.infragistics.com/jquery/editors/order-entry-form. There you can see how you can use the MVC model binding with the editors helpers.

    Look through the different files in the SELECT SAMPLE SOURCE FILE TO VIEW dropdown. There you can find the controller code as well in the OrderEntryFormController.cs file.

    Using the editors helpers with MVC model binding is pretty easy. Just use the corresponding <Helper>For method. They are used the same way as you would use the build-in helpers, the only difference is that you need to call the Render() method in the end.

    For example if you have a model with property Date of type DateTime using <%= Html.Infragistics().DatePickerFor(m => m.Date).Render() %> will populate the date picker with the date from this property. When the HTML Form is posted back to the server if your action accepts a parameter with the same type as your model you will be able to find the modified value in the same Date property.

    Hope this helps,

Children