This is a migrated thread and some comments may be shown as answers.

[Solved] DateTimePickerFor don't work

0 Answers 62 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jakub
Top achievements
Rank 1
Jakub asked on 06 Aug 2010, 04:24 PM

Hi

I have simple application where I have 2 controls DateTimePickerFor and 1 button 

1.<%= Html.Telerik().DatePickerFor(x => Model.DateTo).ButtonTitle("Date from").Name("DateTimePickerTo")%>
2.<%= Html.Telerik().DatePickerFor(x => Model.DateTo).ButtonTitle("Date to").Name("DateTimePickerTo")%>

I have too class Model called DateTimePickerViewModel. In method Index in Controller I have create object for this class

01.public ActionResult Index()
02.{
03.    DateTimePickerViewModel dtpModel = new DateTimePickerViewModel()
04.                 {
05.                        DateFrom = new DateTime(1999, 9, 9),
06.                        DateTo = new DateTime(2000, 10, 10),
07.                          
08.                 ;
09. 
10.    return View(dtpModel);
11.}

When I run application, fileds have data after load page. Problem is when a click button Save. After clicked button is run method Index with parameter DateTimePickerViewModel

1.[HttpPost]
2.public ActionResult Index(DateTimePickerViewModel model)
3.{
4.    //.....
5.    return View(model);
6.}

In this method above parameters have for in properties DateFrom and DateTo null value.

What I'm doing wrong?

P.S Sorry for my poor english

Tags
Date/Time Pickers
Asked by
Jakub
Top achievements
Rank 1
Share this question
or