即使控件中有数据,我的编辑表单中显示的所需数据注释消息也存在问题。如果我单击保存一切正常,如果我将焦点放在显示错误的控件上,然后将焦点更改为另一个控件,则错误消息消失...这似乎只是我的编辑表单中的问题,创建不会'有同样的问题。
我正在使用带有dbcontext生成器的EF 4.2并通过元数据类使用验证数据注释。我的类使用metadataType属性指向元数据类。以下课程:
<MetadataType(GetType(PersonsMetaData))>
Partial Public Class Persons
End Class
Public Class PersonsMetaData
Private mPersonFirstName As Object
Private mPersonLastName As Object
Private mPersonPrimaryEmail As Object
<Required()> _
Public Property PersonFirstName As Object
Get
Return mPersonFirstName
End Get
Set(value As Object)
mPersonFirstName = value
End Set
End Property
<Required()> _
Public Property PersonLastName As Object
Get
Return mPersonLastName
End Get
Set(value As Object)
mPersonLastName = value
End Set
End Property
<Required()> _
Public Property PersonPrimaryEmail As Object
Get
Return mPersonPrimaryEmail
End Get
Set(value As Object)
mPersonPrimaryEmail = value
End Set
End Property
End Class
我的编辑视图已使用mvc 3框架生成。
任何建议都将不胜感激