This question is locked. New answers and comments are not allowed.
Hello,
i'm trying to use the calendar. I'm trying to do quite the same example as the one in demos.
But for any reason the parameter date in my action is always null
Here is my code :
and my controller
Do you have any idea ?
Thanks
i'm trying to use the calendar. I'm trying to do quite the same example as the one in demos.
But for any reason the parameter date in my action is always null
Here is my code :
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml";}<h2>Mon Calendrier</h2>@(Html.Telerik().Calendar() .Name("Calendar") .Selection(settings => settings .Action("SelectAction", new { date="{0}"}) .Dates( new List<DateTime> { DateTime.Today.AddDays(-1), DateTime.Today.AddDays(2), DateTime.Today.AddDays(3), } ) ))@if (ViewData["date"] != null) { <p>This date was clicked: @ViewData["date"]</p> } and my controller
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;namespace GestFormat.Controllers{ public class CalendarController : Controller { // // GET: /Calendar/ public ActionResult Index(DateTime? date) { ViewData["selectedDate"] = ViewData["date"] == null ? DateTime.Now : ViewData["date"]; ViewData["minDate"] = DateTime.Now.AddDays(-7); ViewData["maxDate"] = DateTime.Now.AddMonths(14); return View(); } public ActionResult SelectAction(DateTime? date) { ViewData["date"] = date; return RedirectToAction("Index"); } public ActionResult ReturnContent(string sMsg) { return Content(Server.HtmlEncode(sMsg)); } }}Do you have any idea ?
Thanks