ViewStateModeByIdAttribute Class

Definition

定义元数据特性,ASP.NET 服务器控件使用此特性来指定是否参与根据 ID 加载视图状态信息。Defines the metadata attribute that ASP.NET server controls use to specify whether they participate in loading view-state information by ID. 无法继承此类。This class cannot be inherited.

public ref class ViewStateModeByIdAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public sealed class ViewStateModeByIdAttribute : Attribute
type ViewStateModeByIdAttribute = class
    inherit Attribute
Public NotInheritable Class ViewStateModeByIdAttribute
Inherits Attribute
Inheritance
ViewStateModeByIdAttribute
Attributes

Remarks

ViewStateModeByIdAttribute 类用于指定一个控件,该控件需要 ID的视图状态加载。The ViewStateModeByIdAttribute class is used to specify a control that requires view-state loading by ID. 默认的视图状态加载行为适用于 ASP.NET,它通过页的控件树中的索引加载控件的视图状态信息。The default view-state loading behavior is for ASP.NET to load the view-state information for a control by its index in the control tree of the page. ID 按照加载视图状态信息而产生的性能开销,因为页面控件树必须在加载其视图状态信息之前专门搜索控件。There is a performance cost for loading view-state information by ID because the page control tree must be searched for the control specifically before loading its view-state information.

如果 ViewStateModeByIdAttribute 类用作自定义控件类的元数据特性,If the ViewStateModeByIdAttribute class is used as a metadata attribute of a custom control class,

控件的 LoadViewStateByID 属性返回 truethe LoadViewStateByID property of the control returns true. 如果未使用 ViewStateModeByIdAttribute 类,控件的 LoadViewStateByID 属性将返回其默认值 false,这意味着该控件不会通过 ID加载其视图状态信息。If the ViewStateModeByIdAttribute class is not used, the LoadViewStateByID property of the control returns its default value of false, which means that the control does not load its view-state information by ID.

有关使用特性的详细信息,请参阅特性For more information about using attributes, see Attributes.

ViewStateModeByIdAttribute 类不适用于保存控件的视图状态信息。The ViewStateModeByIdAttribute class does not apply to saving the view-state information for a control.

ViewStateModeByIdAttribute 类 metadata 特性仅对类声明有效。The ViewStateModeByIdAttribute class metadata attribute is valid only on class declarations.

Constructors

ViewStateModeByIdAttribute()

初始化 ViewStateModeByIdAttribute 类的新实例。Initializes a new instance of the ViewStateModeByIdAttribute class.

Properties

TypeId

在派生类中实现时,获取此 Attribute 的唯一标识符。When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)

Methods

Equals(Object)

返回一个值,该值指示此实例是否与指定的对象相等。Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

(Inherited from Attribute)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute()

在派生类中重写时,指示此实例的值是否是派生类的默认值。When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object)

当在派生类中重写时,返回一个指示此实例是否等于指定对象的值。When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对某一对象公开的属性和方法的访问。Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

Applies to

See also