FilterableAttribute 类

定义

指定应用属性的属性是否支持设备筛选。 此类不能被继承。

public ref class FilterableAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)]
public sealed class FilterableAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Property)>]
type FilterableAttribute = class
    inherit Attribute
Public NotInheritable Class FilterableAttribute
Inherits Attribute
继承
FilterableAttribute
属性

示例

下面的代码示例演示如何将属性应用于 FilterableAttribute 自定义控件的属性,以指示该属性不支持设备筛选。


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Samples.AspNet.CS.Controls
{
    public class SimpleCustomControl : WebControl
    {
        private string _productID;

        // Set Filterable attribute to specify that this
        // property does not support device filtering.
        [Bindable(true)]
        [Filterable(false)]
        public string ProductID
        {
            get
            {
                return _productID;
            }
            set
            {
                _productID = value;
            }
        }
    }
}

Imports System.ComponentModel
Imports System.Web.UI

Namespace Samples.AspNet.VB.Controls

    Public Class SimpleCustomControl
        Inherits System.Web.UI.WebControls.WebControl

        Dim _productID As String

        ' Set Filterable attribute to specify that this
        ' property does not support device filtering.
        <Bindable(True), Filterable(False)> Property ProductID() As String
            Get
                Return _productID
            End Get

            Set(ByVal Value As String)
                _productID = Value
            End Set
        End Property
    End Class

End Namespace

注解

FilterableAttribute 属性应用于属性以指定属性是否支持设备筛选。 当属性支持设备筛选时,可以通过指定设备筛选器来替代特定设备的属性的值。 默认情况下,属性是可筛选的,因此控件开发人员可以通过将属性设置为 <a0/> 来阻止对属性进行设备筛选。 有关详细信息,请参阅 “针对特定设备自定义”。

有关使用属性的详细信息,请参阅 “属性”。

有关类实例 FilterableAttribute 的初始属性值列表,请参阅 FilterableAttribute 构造函数。

构造函数

名称 说明
FilterableAttribute(Boolean)

初始化 FilterableAttribute 类的新实例。

字段

名称 说明
Default

表示具有默认属性设置的 FilterableAttribute 预定义对象。 此字段是只读的。

No

表示一个预定义 FilterableAttribute 对象,该对象指示属性不支持设备筛选。 此字段是只读的。

Yes

表示一个预定义 FilterableAttribute 对象,该对象指示属性支持设备筛选。 此字段是只读的。

属性

名称 说明
Filterable

获取一个值,该值指示应用属性的属性是否 FilterableAttribute 支持设备筛选。

TypeId

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)

方法

名称 说明
Equals(Object)

确定类的 FilterableAttribute 当前实例是否等于指定的对象。

GetHashCode()

返回此实例的哈希代码。

GetType()

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()

确定类的 FilterableAttribute 当前实例是否等于 Default 特性。

IsObjectFilterable(Object)

确定指定的 Object 是否支持设备筛选。

IsPropertyFilterable(PropertyDescriptor)

确定属性是否支持设备筛选。

IsTypeFilterable(Type)

确定指定的数据类型是否支持设备筛选。

Match(Object)

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

显式接口实现

名称 说明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

将一组名称映射为对应的一组调度标识符。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

检索对象的类型信息,该信息可用于获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

提供对对象公开的属性和方法的访问。

(继承自 Attribute)

适用于

另请参阅