Click here to Skip to main content
13,152,454 members (36,237 online)
Rate this:
Please Sign up or sign in to vote.
I am having a lot of difficulty trying to start using the DateTimePicker/Calendar object from the Telerik ASP MVC Extensions toolbox kit. I want to REPLACE "@*<select id="Date" style="width:100px"></select>*@" WITH a DateTimePicker/Calendar object

ViewBag.Title = "Appointment Search";
Layout = "~/Views/Shared/_PhysioLayout.cshtml";
<h2>Appointment Search</h2>
<h2>Please select a start date to generate schedule</h2><h6>Default is today</h6>
@*<select id="Date" style="width:100px">
<legend>View By</legend>
<div><input id="Day" type="radio" /><h4>Day</h4></div>
<input id="Week" type="radio" /><h4>Week</h4>
<input id="Month" type="radio" /><h4>Month</h4>
@Html.ActionLink("Display Appointments", "Index")
@Html.ActionLink("Back to Home", "Index")

Basically, what I am trying to do, in the program, I am a physiotherapist, trying to search for different appointments that my patients have booked for, online. Instead of choosing the date and time from a drop down combo box, I want to display a DateTimePicker object or Calendar object where I can simply select a date and time and pass the value of date and time across to the controller where I can use it in other places in the program
I tried this method, as Carl Bergenhem displays in his video:

.Min(new DateTime(2011,1,1)
.Max(new DateTime(2012,1,1)

But that only works in View pages that have been made in ASPX, which is not what I want

I also try doing this:

But after getting to a point...when I type in Html., then "Telerik" doesn't appear in my Intellisense in Microsoft Visual Studio Ultimate 2010

Please suggest a simple tutorial on how to create the datetimepicker/calendar object in a View page that is made in Razor (CSHTML) in ASP.NET MVC 3. And also how to pass the values from there to a controller

Thank You
Posted 31-Jul-11 8:01am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Do you have a @using Telerik.Web.Mvc.UI directive at the top of your view? Then, do you have the following in your web.config in your Views folder, not the web.config in the root folder1:
  <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <add namespace="Telerik.Web.Mvc" />
      <add namespace="Telerik.Web.Mvc.UI" />

Then, the simplest 'tutorial' or quickstart is to look at the controller code and the Razor view code in the Telerik exmaples. You can find these locally if you chose to install them, or they are available online.

1 I doubt it hurts to have these in all the web.configs you want to, but it must be in the Views folder config.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170924.2 | Last Updated 31 Jul 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100