开发者

ASP.Net MVC, strongly typed view with DateTime not accepted?

开发者 https://www.devze.com 2022-12-29 18:59 出处:网络
I wish to create a view like <%@ Control Language=\"C#\" Inherits=\"System.Web.Mvc.ViewUserControl<System.DateTime?&开发者_Python百科gt;\" %>

I wish to create a view like

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?&开发者_Python百科gt;" %>

but I get an error saying that DateTime must be a reference type in order to use for parameter TModel.

Fair enough, but I google plenty of examples that implement just what I try to achieve.

Any clues as to what I need to change/install/update?

Any comments welcome,

Anders, Denmark


The .NET 4 documentation doesn't show a constraint on TModel, but the .NET 3.5 docs do. I don't know the details of MVC versioning, but my guess is you need to upgrade to version 2 of MVC.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号