SqlDataSourceFilteringEventArgs SqlDataSourceFilteringEventArgs SqlDataSourceFilteringEventArgs SqlDataSourceFilteringEventArgs Class

정의

Filtering 컨트롤의 SqlDataSource 이벤트에 대한 데이터를 제공합니다.Provides data for the Filtering event of the SqlDataSource control.

public ref class SqlDataSourceFilteringEventArgs : System::ComponentModel::CancelEventArgs
public class SqlDataSourceFilteringEventArgs : System.ComponentModel.CancelEventArgs
type SqlDataSourceFilteringEventArgs = class
    inherit CancelEventArgs
Public Class SqlDataSourceFilteringEventArgs
Inherits CancelEventArgs
상속
SqlDataSourceFilteringEventArgsSqlDataSourceFilteringEventArgsSqlDataSourceFilteringEventArgsSqlDataSourceFilteringEventArgs

예제

다음 코드 예제에서는 Northwind 데이터베이스에서 데이터를 검색 하 고 사용 하 여 필터링 하는 방법을 보여 줍니다.는 FilterExpressionFilterParameters입니다.The following code example demonstrates how to retrieve data from the Northwind database and filter it using a FilterExpression and FilterParameters. FilterExpressionSqlDataSource 언제 든 지 적용 되는 Select 데이터를 검색할 메서드를 실행 합니다.The FilterExpression of the SqlDataSource is applied anytime the Select method is executed to retrieve data. 이 예제에서는 합니다 FilterExpression 에 포함 된 필터 매개 변수에 대 한 자리 표시자를 포함 합니다 FilterParameters 컬렉션입니다.In this example, the FilterExpression contains a placeholder for a filter parameter, which is contained in the FilterParameters collection. Filtering 경우 filter 매개 변수는에 표시 되는 Label 컨트롤입니다.In the Filtering event, the filter parameter is displayed in a Label control.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    //Protected Sub SqlDataSource1_Filtering(ByVal sender As Object, _
    //    ByVal e As System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs)
    //    Label1.Text = e.ParameterValues(0).ToString()
    //End Sub


    protected void SqlDataSource1_Filtering(object sender, SqlDataSourceFilteringEventArgs e)
    {
        Label1.Text = e.ParameterValues[0].ToString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="FORM1" runat="server">

            <p>Show all employees with the following title:
            <asp:DropDownList
                id="DropDownList1"
                runat="server"
                AutoPostBack="True">
                <asp:ListItem>Sales Representative</asp:ListItem>
                <asp:ListItem>Sales Manager</asp:ListItem>
                <asp:ListItem>Vice President, Sales</asp:ListItem>
            </asp:DropDownList></p>

            <asp:SqlDataSource
                id="SqlDataSource1"
                runat="server"
                ConnectionString="<%$ ConnectionStrings:NorthwindConnection %>"
                SelectCommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
                FilterExpression="Title='{0}'" OnFiltering="SqlDataSource1_Filtering">
                <FilterParameters>
                    <asp:ControlParameter Name="Title" ControlId="DropDownList1" PropertyName="SelectedValue"/>
                </FilterParameters>
            </asp:SqlDataSource><br />

            <asp:GridView
                id="GridView1"
                runat="server"
                DataSourceID="SqlDataSource1"
                AutoGenerateColumns="False">
                <columns>
                    <asp:BoundField Visible="False" DataField="EmployeeID" />
                    <asp:BoundField HeaderText="First Name" DataField="FirstName" />
                    <asp:BoundField HeaderText="Last Name" DataField="LastName" />
                </columns>
            </asp:GridView>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        </form>
    </body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub SqlDataSource1_Filtering(ByVal sender As Object, _
        ByVal e As System.Web.UI.WebControls.SqlDataSourceFilteringEventArgs)
        Label1.Text = e.ParameterValues(0).ToString()
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">

            <p>Show all employees with the following title:
            <asp:DropDownList
                id="DropDownList1"
                runat="server"
                AutoPostBack="True">
                <asp:ListItem>Sales Representative</asp:ListItem>
                <asp:ListItem>Sales Manager</asp:ListItem>
                <asp:ListItem>Vice President, Sales</asp:ListItem>
            </asp:DropDownList></p>

            <asp:SqlDataSource
                id="SqlDataSource1"
                runat="server"
                ConnectionString="<%$ ConnectionStrings:NorthwindConnection %>"
                SelectCommand="SELECT EmployeeID,FirstName,LastName,Title FROM Employees"
                FilterExpression="Title='{0}'" OnFiltering="SqlDataSource1_Filtering">
                <FilterParameters>
                    <asp:ControlParameter Name="Title" ControlId="DropDownList1" PropertyName="SelectedValue"/>
                </FilterParameters>
            </asp:SqlDataSource><br />

            <asp:GridView
                id="GridView1"
                runat="server"
                DataSourceID="SqlDataSource1"
                AutoGenerateColumns="False">
                <columns>
                    <asp:BoundField Visible="False" DataField="EmployeeID" />
                    <asp:BoundField HeaderText="First Name" DataField="FirstName" />
                    <asp:BoundField HeaderText="Last Name" DataField="LastName" />
                </columns>
            </asp:GridView>
                <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        </form>
    </body>
</html>

설명

SqlDataSourceFilteringEventArgs 클래스에 데이터를 전달 하는 데 사용 됩니다 합니다 Filtering 이벤트 처리기는 SqlDataSource 컨트롤입니다.The SqlDataSourceFilteringEventArgs class is used to pass data to the Filtering event handler of the SqlDataSource control. ParameterValues 필터링 작업을 수행 하기 전에 속성은 필터 매개 변수 값에 대 한 액세스를 제공 합니다.The ParameterValues property provides access to the filter parameter values before the filtering operation is performed. 취소할 수 있습니다는 Select 설정 하 여 메서드를 Cancel 의 속성을 ObjectDataSourceFilteringEventArgstrue.You can cancel the Select method by setting the Cancel property of the ObjectDataSourceFilteringEventArgs to true. 필터링이 지원 때 합니다 DataSourceMode 속성을 DataSet 값.Filtering is supported when the DataSourceMode property is set to the DataSet value.

생성자

SqlDataSourceFilteringEventArgs(IOrderedDictionary) SqlDataSourceFilteringEventArgs(IOrderedDictionary) SqlDataSourceFilteringEventArgs(IOrderedDictionary) SqlDataSourceFilteringEventArgs(IOrderedDictionary)

지정된 개체를 사용하여 SqlDataSourceFilteringEventArgs 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the SqlDataSourceFilteringEventArgs class by using the specified object.

속성

Cancel Cancel Cancel Cancel

이벤트를 취소해야 할지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether the event should be canceled.

(Inherited from CancelEventArgs)
ParameterValues ParameterValues ParameterValues ParameterValues

IOrderedDictionary 클래스의 Parameter 개체에 액세스할 수 있도록 하는 SqlDataSource 개체를 가져옵니다.Gets an IOrderedDictionary object that provides access to the Parameter objects of the SqlDataSource class.

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

적용 대상

추가 정보