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用以表示該屬性所套用的屬性支援裝置過濾;否則,。 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 值。

適用於

另請參閱