ViewDataAttribute ViewDataAttribute 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.

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

Constructors

ViewDataAttribute() ViewDataAttribute() ViewDataAttribute()

Properties

Key Key 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