FilterableAttribute(Boolean) 建構函式

定義

初始化 FilterableAttribute 類別的新執行個體。

public:
 FilterableAttribute(bool filterable);
public FilterableAttribute (bool filterable);
new System.Web.UI.FilterableAttribute : bool -> System.Web.UI.FilterableAttribute
Public Sub New (filterable As Boolean)

參數

filterable
Boolean

true 指示套用此屬性 (Attribute) 的屬性 (Property) 支援裝置篩選,否則為 false

範例

下列程式碼範例示範如何將屬性套用 FilterableAttribute 至自訂控制項的 屬性。 這個建構函式是由 ASP.NET 在內部呼叫,以建立 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 。 下表顯示 類別實例 FilterableAttribute 的初始屬性值。

屬性 初始值
Filterable filterable 參數的值。

適用於

另請參閱