Also the same problem for <DisplayFormat( DataFormatString="{0:d}")>
Here's an example that does both:
<MetadataType(GetType(OrderMD))> _
Partial Public Class [Order]
End Class
Public Class [OrderMD]
<DataType(DataType.Date)> _
Public OrderDate As Object
<DisplayFormat(DataFormatString:="{0:d}")> _
Public RequiredDate As Object
End Class
Note the colon before the equals sign and after DataFormatString. And also the
underscore after > symol.
Hope this helps [:D]
Dynamic DataMetadataAttributesVB
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
grajasekaran
Member
3 Points
4 Posts
Dynamic Data website - MetaDatatype and DisplayFormat in VB
Aug 07, 2008 03:35 PM|LINK
I am using vb for Dynamic data websites. I can not use
[metaDataType(typeof(mymetadata))]. So I tried like <MetadataType(typeof(myMetadata))>
I receive error message "insert Is". And then Type Expected. Can anyone give correct syntax for using this.
Also the same problem for <DisplayFormat( DataFormatString="{0:d}")>
Please give me syntax in VB to fix these errors. Thanks
scothu
Participant
1436 Points
291 Posts
Microsoft
Moderator
Re: Dynamic Data website - MetaDatatype and DisplayFormat in VB
Aug 07, 2008 04:16 PM|LINK
Look up the syntax for doing attributes in VB for more detail. But the general format is like this:
<MetadataType(GetType(FooClassMetadata))> _
Partial Public Class FooClass
End Class
Public Class FooClassMetadata
End Class
PM, ASP.NET Team, Microsoft
sjnaughton
All-Star
27391 Points
5485 Posts
MVP
Re: Dynamic Data website - MetaDatatype and DisplayFormat in VB
Aug 07, 2008 09:47 PM|LINK
Here's an example that does both:
<MetadataType(GetType(OrderMD))> _ Partial Public Class [Order] End Class Public Class [OrderMD] <DataType(DataType.Date)> _ Public OrderDate As Object <DisplayFormat(DataFormatString:="{0:d}")> _ Public RequiredDate As Object End ClassNote the colon before the equals sign and after DataFormatString. And also the underscore after > symol.
Hope this helps [:D]
Dynamic Data Metadata Attributes VB
Always seeking an elegant solution.
grajasekaran
Member
3 Points
4 Posts
Re: Dynamic Data website - MetaDatatype and DisplayFormat in VB
Aug 08, 2008 01:09 PM|LINK
sjnaughton, Thank you very much for this fast reply with details as I really need.
It works fine. Thanks
grajasekaran
Member
3 Points
4 Posts
Re: Dynamic Data website - MetaDatatype and DisplayFormat in VB
Aug 08, 2008 01:11 PM|LINK
scothu, thanks for your sample coding. It helps me a lot.
Thanks.