ViewDataAttribute Class

Definition

Properties decorated with ViewDataAttribute will have their values stored in and loaded from the ViewDataDictionary. ViewDataDictionary is supported on properties of Controllers, and Razor Page handlers.

public ref class ViewDataAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)]
public sealed class ViewDataAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Property, AllowMultiple=false, Inherited=true)>]
type ViewDataAttribute = class
    inherit Attribute
Public NotInheritable Class ViewDataAttribute
Inherits Attribute
Inheritance
ViewDataAttribute
Attributes

Constructors

ViewDataAttribute()

Properties

Key

Gets or sets the key used to get or add the property from value from ViewDataDictionary. When unspecified, the key is the property name.

Applies to