使用可空字段时的MVC 3 @ Html.DisplayFor [英] MVC 3 @Html.DisplayFor when working with nullable fields
问题描述
使用VS2010和MVC 3 ...
我的模型上的可空字段被声明为Double?和日期?
在我的视图中,我使用@ Html.DisplayFor输出字段,它将分别显示0和1/1/0001。
当这些属性的值为空时,是否在视图中不显示任何内容?
< blockquote>
你好,
MVC 3使用一种脚本VBN,这个论坛没有参加。
官方但是MVC的微软asp论坛是。
http://forums.asp.net/1146.aspx/1?MVC
如果你没有成功,你也可以试用Visual Basic。
http://forums.asp.net/36.aspx/1?Visual+Basic+NET
Using VS2010 and MVC 3...
I have nullable fields on my model declared as Double? and Date?
In my view I use @Html.DisplayFor to output the fields and it will show 0 and 1/1/0001 respectively.
Is there anyway to show nothing in the view when the value for those properties are null?
Hello,
MVC 3 uses a kind of scripting VBN, this forum is not attended for that.
The official Microsoft asp forum for MVC however is.
http://forums.asp.net/1146.aspx/1?MVC
If you are not succesfull in that one you also can try the Visual Basic one.
这篇关于使用可空字段时的MVC 3 @ Html.DisplayFor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!