ControlFilterExpression 類別

定義

使用資料繫結控制項中選取的項目資料索引鍵來修改資料庫查詢。Modifies a database query by using the data key of the item that is selected in a data-bound control.

public ref class ControlFilterExpression : System::Web::UI::WebControls::Expressions::DataSourceExpression
public class ControlFilterExpression : System.Web.UI.WebControls.Expressions.DataSourceExpression
type ControlFilterExpression = class
    inherit DataSourceExpression
Public Class ControlFilterExpression
Inherits DataSourceExpression
繼承
ControlFilterExpression

範例

下列範例示範如何使用ControlFilterExpression類別來參考源資料繫結控制項, 其中已選取資料索引鍵。The following example shows how to use the ControlFilterExpression class to reference a source data-bound control, where the data key is selected. QueryExtender控制項會指向目標資料來源控制項, 以取得使用選取的資料索引鍵進行篩選的資料。The QueryExtender control points to a target data source control that obtains data that is filtered by using the selected data key. 在此範例中, 源資料繫結控制項會參考父資料表, 而目標資料繫結控制項則參考子資料工作表。In the example, the source data-bound control references a parent table and the target data-bound control references a child table.

<asp:QueryExtender ID="QueryExtenderID"   
    TargetControlID="TargetDataSourceID" runat="server">  
    <asp:ControlFilterExpression ControlID="SourceGridViewID" />  
</asp:QueryExtender>  

備註

設計用來在頁面包含兩個資料繫結控制項 (例如GridView控制項和ListView控制項) 時使用的類別。ControlFilterExpressionThe ControlFilterExpression class that is designed to be used when a page contains two data-bound controls such as a GridView control and a ListView control. 其中一個控制項是 [來源], 其中選取了 [資料索引鍵 (列)]。One control is the source, where a data key (row) is selected. 另一個控制項是根據選取的資料索引鍵顯示資料的目標。The other control is the target where the data is displayed based on the selected data key. 目標資料是由執行QueryExtender類別中所定義且使用選取的資料索引鍵所建立之查詢的資料來源控制項所取得。The target data is obtained by a data source control that executes the query that is defined in the QueryExtender class and that is built by using the selected data key.

若要在ControlFilterExpression頁面中使用類別, 請遵循下列步驟:To use the ControlFilterExpression class in a page, you follow these steps:

建構函式

ControlFilterExpression()

初始化 ControlFilterExpression 類別的新執行個體。Initializes a new instance of the ControlFilterExpression class.

屬性

Column

取得或設定查詢所依據的資料行名稱。Gets or sets the name of the column that the query is based on.

Context

取得擁有者控制項的 HttpContext 執行個體。Gets the HttpContext instance of the owner control.

(繼承來源 DataSourceExpression)
ControlID

取得或設定來源資料繫結控制項的識別碼。Gets or sets the ID of the source data-bound control.

DataSource

取得與擁有者控制項相關聯的資料來源物件。Gets the data source object that is associated with the owner control.

(繼承來源 DataSourceExpression)
IsTrackingViewState

取得值,這個值指出資料來源運算式物件是否正在追蹤其檢視狀態變更。Gets a value that indicates whether a data source expression object is tracking its view state changes.

(繼承來源 DataSourceExpression)
Owner

取得擁有者控制項。Gets the owner control.

(繼承來源 DataSourceExpression)
ViewState

取得 StateBag 類別的執行個體,這個執行個體包含目前的檢視狀態資訊。Gets an instance of the StateBag class that contains the current view state information.

(繼承來源 DataSourceExpression)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetQueryable(IQueryable)

取得要修改的資料來源查詢。Gets the data source query to modify.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
LoadViewState(Object)

還原先前儲存的檢視狀態。Restores the previously saved view state.

MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(繼承來源 Object)
SaveViewState()

儲存自頁面張貼到伺服器以來的檢視狀態變更。Saves the changes to view state since the time the page was posted to the server.

SetContext(Control, HttpContext, IQueryableDataSource)

使用資料來源資訊初始化篩選條件運算式。Initializes the filter expression with data source information.

SetDirty()

標記 DataSourceExpression 物件,以便將其狀態儲存在檢視狀態中。Marks the DataSourceExpression object so that its state will be saved in view state.

(繼承來源 DataSourceExpression)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TrackViewState()

ControlFilterExpression 物件追蹤其檢視狀態的變更,以便將變更儲存在控制項的檢視狀態物件中,並使這個物件能在相同網頁的要求之間存續。Causes the ControlFilterExpression object to track changes to its view state so they can be stored in the control's view state object and to be persisted across requests for the same page.

明確介面實作

IStateManager.IsTrackingViewState

當由類別實作時取得值,這個值指出資料來源運算式物件是否正在追蹤其檢視狀態變更。When implemented by a class, gets a value that indicates whether a data source expression object is tracking its view state changes.

(繼承來源 DataSourceExpression)
IStateManager.LoadViewState(Object)

當由類別實作時,載入資料來源運算式物件先前儲存的檢視狀態。When implemented by a class, loads the previously saved view state of the data source expression object.

(繼承來源 DataSourceExpression)
IStateManager.SaveViewState()

當類別實作時,儲存 DataSourceExpression 物件的目前檢視狀態。When implemented by a class, saves the current view state of the DataSourceExpression object.

(繼承來源 DataSourceExpression)
IStateManager.TrackViewState()

當由類別實作時,追蹤 DataSourceExpression 物件的檢視狀態變更,以便該變更可針對資料來源運算式物件儲存到 StateBag 物件中。When implemented by a class, tracks view state changes of the DataSourceExpression object so that the changes can be stored in the StateBag object for the data source expression object.

(繼承來源 DataSourceExpression)

適用於

另請參閱