Although this topic hasn't been touched in a while, I ran into similar issues to the OP and the second poster, so I'm going to share the answers that I came across - Hopefully this helps out someone in the future.
@Chints
You probably want to make an Editor Template for Dates, which would involve making an EditorTemplates Folder in the Views->Shared folder, and then creating a CSHTML file called "DateTime.cshtml". This view will look kind of like the following:
Then replace your input with an @Editorfor a DateTime field from your model. It will automatically be replaced with with your editor template (Which will be a DateTimepicker in this case).
For more details on the topic of Editor Templates, refer to
Brad Wilson's Blog Post which covers templating in MVC in general (Although it doesn't use Razor Syntax).
@Dean
So, your three concerns in order were:
1. how to pass the selected value to an ActionMethod
2. how to use the DatePicker for date only (no time)
3. how to bind a database value or model property to the DatePicker
Georgi has a fairly comprehensive set of answers, but hopefully this adds some clarity. . .
1. how to pass the selected value to an ActionMethod
As Georgi mentioned, this is more of a function of MVC than of Telerik - You either encapsulate your controls in a form and submit them with the form, or pass the value through with the URL Route Values. Another decent site for learning such a thing would be
here.
2. how to use the DatePicker for date only (no time)
As Georgi mentioned, the Telerik Datepicker control only passes a date, with time set to zero. If you need a fast implementation of this, you can use the editor template block I posted above, and just change it from a DateTimePicker to just a DatePicker. It will render out and return a value only for the date component.
3. how to bind a database value or model property to the DatePicker
The easiest way I've found to do this is to bind a DateTime property to the model you're using for your view, and then referencing that model in an EditorFor, as follows:
If MyDate is a DateTime, it will automatically replace it with the Editor Template.
@Georgi
Dean does have a legitimate point in saying that the Telerik Documentation is a little difficult to read in some areas, for example the MVC grid demos barely mention that the Date.cshtml is a Template - If you don't already know what you're looking at, you probably won't be able to figure it out. Additionally, most of the documentation is fairly far from entry level friendly, it mostly assumes that you know your way around the framework - The datepicker is a great example here, as for people that don't already know how to implement a jQuery object, it's a little bit ambiguous in how you actually render the object to play with, let alone getting it to behave in a customized manner. While it might seem obvious from an experienced perspective, it probably wouldn't hurt to link offsite to the concepts being applied in some cases.