Hey Y'all..
Trying to get started with MS's implementation of MVC and I'm already in a jam..
I have a have a route like so:
routes.MapRoute( "Custom", // Route name
"RightHere/{entryDate}", // URL with parameters
new { controller = "RightHere", action = "GetDate" } // Parameter defaults
);
And the corresponding controller action (RightHereController) looks like so:
public ActionResult GetDate(DateTime date)
{
try
{
ViewData["Date"] = date;
return View();
}
catch
{
return View();
}
}
The view:
<h2>RightHere</h2>
<p><%= Html.Encode(ViewData["Date"]) %></p>
Simple enough.. But get the orange screen of death when using URL /RightHere/GetDate/1-1-2009
:
The parameters dictionary contains a null entry for parameter 'date' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult GetDate(System.DateTime)'
Need you more tenured Ms MVC peps tell me what I'm missing :)