Reputation: 2380
I want to change this code from MVC2
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
<%=Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" }) %>
To MVC 3 using Razor.
You can find the full post of what I want to do here
Upvotes: 22
Views: 20325
Reputation: 13691
@model DateTime?
@Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" })
Upvotes: 41