Intersoft Support Center

Use FilterExpression and SortExpression

FilterExpression is used to filter the data retrieved when the Select method is called. The method specified in the SelectMethod property must return a DataSet, DataView or DataTable.

SortingExpression is used to sort the data retrieved by ISDataSourceControl. The SortExpression in ISDataSource will always act as secondary sorting after the data-bound controls sorting mechanism.

This sample demonstrates how to use FilterExpression and SortExpression.

To use ISDataSource along with FilterExpression

  1. Binding DataSet to ISDataSource. (Use Products table).
  2. Add a TextBox and a Server-side button.
  3. Write the following function in OnButtonClick Client-side event :
  4. C# Copy ImageCopy Code
    protected void Button1_Click(object sender, EventArgs e)
    {
       ISDataSourceTable table = ISDataSource1.Tables.GetNamedItem("Products");
       table.FilterExpression = TextBox1.Text;
    }

  5. The result will be like following.
    ISFilterExpression


To use ISDataSource along with SortExpression

  1. Binding DataSet to ISDataSource. (Use Customers table).
  2. Add a TextBox and a server-side button.
  3. Write the following function in OnButtonClick client-side event:
    C# Copy ImageCopy Code
    protected void Button1_Click(object sender, EventArgs e)
    {
       ISDataSourceTable table = ISDataSource1.Tables.GetNamedItem("Customers");
       table.SortExpression = TextBox1.Text;
       GridView1.DataBind();
    }
  4. The result will be like following.
Previous Next