roncansan
roncansan

Reputation: 2380

MVC 3 Editor Template with DateTime

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

Answers (1)

Fabian
Fabian

Reputation: 13691

@model DateTime?

@Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" })

Upvotes: 41

Related Questions