3

谁能告诉我这个的VB等价物是什么:

@model DateTime

Using Date Template 

@Html.TextBox("", String.Format("{0:d}", Model.ToShortDateString()), 
  new { @class = "datefield", type = "date"  })

我试过了:

@model DateTime 

使用日期模板

@Html.TextBox("", String.Format("{0:d}", Model.ToShortDateString()), New With {Key .class = "datefield", Key .type = "date"})

...但错误是:NullReferenceException 未被用户代码对象变量处理或未设置块变量。

它来自教程:使用 HTML5 和 jQuery UI Datepicker Popup Calendar with ASP.NET MVC - Part 4

4

2 回答 2

0

你能确定,你是从控制器向视图发送 NOT NULL 的 Model 实例吗?休息对我来说一切都很好。前任:

Function Index() As ActionResult
        ViewData("Message") = "Welcome to ASP.NET MVC!"

        Return View(New Employee()) 'See the : New Employee()'
End Function
于 2012-04-30T11:30:46.887 回答
0

代替@model,您可以尝试如下所示的ModelType,

 @ModelType DateTime

 @Html.ActionLink("Edit", "Edit", New With {.id = item.ID})

谢谢

迪普

于 2012-04-30T11:27:32.833 回答