Export (0) Print
Expand All
1 out of 3 rated this helpful - Rate this topic

UIHintAttribute Class

Specifies the template or user control that Dynamic Data uses to display a data field.

System.Object
  System.Attribute
    System.ComponentModel.DataAnnotations.UIHintAttribute

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
'Declaration
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := True)> _
Public Class UIHintAttribute _
	Inherits Attribute

The UIHintAttribute type exposes the following members.

  NameDescription
Public methodUIHintAttribute(String)Initializes a new instance of the UIHintAttribute class by using a specified user control.
Public methodUIHintAttribute(String, String)Initializes a new instance of the UIHintAttribute class using the specified user control and specified presentation layer.
Public methodUIHintAttribute(String, String, Object())Initializes a new instance of the UIHintAttribute class by using the specified user control, presentation layer, and control parameters.
Top
  NameDescription
Public propertyControlParametersGets or sets the DynamicControlParameter object to use to retrieve values from any data source.
Public propertyPresentationLayerGets or sets the presentation layer that uses the UIHintAttribute class.
Public propertyTypeIdGets the unique identifier for the attribute. (Overrides Attribute.TypeId.)
Public propertyUIHintGets or sets the name of the field template to use to display the data field.
Top
  NameDescription
Public methodEqualsGets a value that indicates whether this instance is equal to the specified object. (Overrides Attribute.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeGets the hash code for the current instance of the attribute. (Overrides Attribute.GetHashCode.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.)
Public methodMatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top
  NameDescription
Explicit interface implemetationPrivate method_Attribute.GetIDsOfNamesMaps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoRetrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.GetTypeInfoCountRetrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute.)
Explicit interface implemetationPrivate method_Attribute.InvokeProvides access to properties and methods exposed by an object. (Inherited from Attribute.)
Top

A Visual Studio MVC project with source code is available to accompany this topic: Download MVC uses the UIHintAttribute class to associate a model with a data field. Dynamic Data uses the UIHintAttribute class to associate a user control with a data field. Dynamic Data uses the UIHint property to determine which user control to use in order to display a data field.

For more information about how to use attributes, see Extending Metadata Using Attributes.

The following example shows how to use the UIHintAttribute attribute to specify the name of a custom field template that will handle the display and editing of a data field.

For a complete example, see How to: Customize Data Field Display in the Data Model.


Imports System
Imports System.Web.DynamicData
Imports System.ComponentModel.DataAnnotations


<MetadataType(GetType(ProductMetadata))> _
Partial Public Class Product

End Class

Partial Public Class ProductMetadata
    <UIHint("UnitsInStock")> _
    <Range(100, 10000)> _
    Public UnitsInStock As Object
End Class



.NET Framework

Supported in: 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.