Last post Oct 27, 2010 08:29 AM by micmac
Oct 20, 2010 06:40 AM|micmac|LINK
I have an ASP.net website build in VB 2010 web dev pro using 4.0 framework. Its a dynamic data site and I am having some trouble formating some of the field and page canned templates.
Q1: Field Templates - the tooltip code (TextBox1.ToolTip = Column.Description) is within the ascx.vp pages for each of the field templates. Where
can I update each columns description (as the code references) so the tooptip will be column/field specific. If its not as straight forward as that, I was trying to write an if/else statement because the tooltip code is set at the field type level (decimal,
date, etc) and I want it to be column specific. example;
if column.value = Financial Impact
then TextBox1.ToolTip = "enter financial impact in whole dollars"
else TextBox1.ToolTip = "next fields tooltip text"
Q2: The site allows the ability to edit existing items or create a new one, all using the dynamic data templates, but I want to be able to sort the fields for the edit and creating new pages, into a more
logical order where currently I am not sure the logic the dynamic site is using to sort (cause they are not alphabetical, may be based on the type of field cause all decimal types are together and all varchar(Max) fields are together and all foriegn key fields
are together). Is there an easy way to change the order of the field as to how they appear within the edit or create new pages?
Oct 20, 2010 10:29 AM|sjnaughton|LINK
Hi Micmac, this is how you add Metadata (which is really whay you are asking in Q1)
Partial Public Class Address
Friend NotInheritable Class AddressMetadata
Public AddressID As Integer
<Display(Order = 0)> _
Public AddressLine1 As String
<Display(Order = 1)> _
Public AddressLine2 As String
<Display(Order = 2)> _
Public City As String
<Description("A Country or Region.")> _
<Display(Order = 3)> _
Public CountryRegion As String
<Display(Order = 5)> _
Public CustomerAddresses As EntityCollection(Of CustomerAddress)
<Display(Order = 4)> _
Public ModifiedDate As DateTime
This is called annotating or adding metadata to your data model.
Q2. you can use the DisplayAttribute to sort, turn columns off and change the display name.
Dynamic Data 4
Oct 27, 2010 06:47 AM|micmac|LINK
But I get the following Error message when trying to apply this code in a new class;
'Description' cannot be used as an attribute because it does not inherit from 'System.Attribute'.
So I already have a MetaData class defined for the table the field resides in that I want to change the WebDescription and/or Order but if I attemt to add the following to that class I get an error "Attribute 'WebDescriptionAttribute' cannot be applied to 'Description'
because the attribute is not valid on this declaration type."
<WebDescription("A Country or Region.")> _
Public Description As Object
Oct 27, 2010 08:29 AM|micmac|LINK
Please Ignor my last post / question.... as to my receiving errors. I figured it out. Thanks so much