Version

Configuring Excel Style Filtering

Topic Overview

Purpose

This topic explains how to configure the Excel-Style Filtering options of the WebDataGrid™ control.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

This topic demonstrates how to add the WebDataGrid to your page and retrieve the customers table of the Northwind database.

This topic introduces the Excel-Style Filtering feature of the WebDataGrid control.

This topic provides reference about the properties that are specific to the Excel-Style Filtering feature of the WebDataGrid control.

Excel-Style Filtering Configuration Summary

Excel-Style Filtering configuration summary chart

The following table lists the configurable aspects of the Excel-Style Filtering feature of the WebDataGrid control.

Configurable aspects Details Properties

You can specify the capitalization of values into the filtering dropdown. The available options are: lowercase capitalization, uppercase capitalization, and camelcase capitalization.

You can specify custom text for Null values in the filtering drop-down.

Configuring the Capitalization of the Unique Values in the Filtering Drop-Down

Overview

The capitalization options for the unique values are the following:

  • Lowercase capitalization (default) – the items appear in lowercase letters

  • Uppercase capitalization – the items appear in uppercase letters (all caps)

  • Camelcase capitalization – the items appear with sentence capitalization (Only the first letter of the item is capitalized even if the item consists of more than one words.)

The capitalization is managed by the UniqueValueCasing property.

The capitalization of unique values can be set on two levels – per column and for the whole grid depending on whether the respective property of the grid or of the column is being set. The column setting takes priority.

Property settings

The following table maps the desired capitalization configurations of the property settings that configure them:

In order to: Use this property: And set it to:

Configure lowercase capitalization for the items in the filtering drop-down in lower case

Lower

Configure uppercase capitalization for the items in the filtering drop-down in upper case

Upper

Configure camelcase capitalization for the items in the filtering drop-down with only the first capitalized

Camel

Prerequisites

To complete the procedure, you need the following:

  • An ASP.NET Web project with a WebDataGrid instantiated on a web page

  • The WebDataGrid bound to a SqlDataSource component and configured to retrieve the CustomerID , CompanyName , ContactName , and ContactTitle fields from the Customers table of the Northwind sample database. (For details, see the Getting Started with WebDataGrid topic.)

Configuring the capitalization of unique values using the Designer

Configuring the capitalization on grid level

To set the UniqueValueCasing property to Camel on grid-level using the designer:

1. From the smart tag of the WebDataGrid , open the WebDataGrid Designer.

WDG ExcelStyleFiltering Configuring CE 1.png

2. In the left pane, select the desired filtering behavior.

3. In the right pane, set the UniqueValueCasing property to Camel .

4. Click the OK button.

Configuring the capitalization on column level

For the purpose of this example, the setting will be applied to a column with the key ContactName . The procedure assumes that the ContactName column has been added in advance. For information on how to add the column, see the Enabling Excel-Style Filtering (WebDataGrid) topic.

To set the UniqueValueCasing property to Camel on the column level:

1. From the smart tag of the WebDataGrid , open the WebDataGrid Designer.

2. In the left pane, select the desired filtering behavior.

3. In the left pane, locate the ColumnSettings property and click the ellipsis (…) button. The Column Setting dialog opens up.

In the column setting, from the drop-down, select the ContactName column.

Under the Appearance section, from the drop-down of the UniqueValueCasing property, select Camel .

WDG ExcelStyleFiltering Configuring CE 2.png

4. Click the OK button.

Configuring the capitalization of unique values in the ASPX markup

Configuring the capitalization on grid level

The following code demonstrates how to set the UniqueValueCasing property to Camel on grid level in the ASPX markup.

In ASPX:

<Behaviors>
    <ig:Filtering FilterType="ExcelStyleFilter" UniqueValueCasing="Camel">
    </ig:Filtering>
</Behaviors>

Configuring the capitalization on column level

The following code demonstrates how to set the UniqueValueCasing property to Camel on grid level in the ASPX markup. The setting is applied to a column with the key ContactName .

In ASPX:

<Behaviors>
    <ig:Filtering FilterType="ExcelStyleFilter">
        <ColumnSettings>
            <ig:ColumnFilteringSetting ColumnKey="ContactName" UniqueValueCasing="Camel" />
        </ColumnSettings>
    </ig:Filtering>
</Behaviors>

Configuring the capitalization of unique values in the code-behind

Configuring the capitalization on grid level

The following code demonstrates how to set the UniqueValueCasing property to Camel on grid level in the code-behind.

In C#:

//Create a Filtering Behavior
this.WebDataGrid2.Behaviors.CreateBehavior<Filtering>();
//Set Filtering Behavior to Excel Style Filter
this.WebDataGrid2.Behaviors.Filtering.FilterType =
    Infragistics.Web.UI.GridControls.FilteringType.ExcelStyleFilter;
//Set the UniqueValueCasing to Camel on Grid level
this.WebDataGrid2.Behaviors.Filtering.UniqueValueCasing = UniqueValueCasing.Camel;

Configuring the capitalization on column level

The following code demonstrates how to set the UniqueValueCasing property to Camel on grid level in the code-behind. The setting is applied to a column with the key ContactName .

In C#:

//Create a Filtering Behavior
this.WebDataGrid2.Behaviors.CreateBehavior<Filtering>();
//Set Filtering Behavior to Excel Style Filter
this.WebDataGrid2.Behaviors.Filtering.FilterType =
    Infragistics.Web.UI.GridControls.FilteringType.ExcelStyleFilter;
//Create a ColumnFilteringSetting
ColumnFilteringSetting settingColumn = new ColumnFilteringSetting();
//Set the ColumnKey
settingColumn.ColumnKey = "ContactName";
//Set the UniqueValueCasing to Camel on column level
settingColumn.UniqueValueCasing = UniqueValueCasing.Camel;
//Add the created ColumnSetting
this.WebDataGrid2.Behaviors.Filtering.ColumnSettings.Add(settingColumn);

Configuring the Text for the Null Values in the Filtering Drop-Down

Overview

Setting the null value text allows you to change the text for the item in the filter drop-down. This text will be displayed for the items that have a Null value in the data source / database. The NullValueText property is of type string and has a default value of Null .

Preview

Following is the result after NullValueText property is set to My Null .

WDG ExcelStyleFiltering Configuring CE 3.png

Property settings

The following table maps the desired configuration of the NullValueText property settings:

In order to: Use this property: And set it to:

Set the text for the items with null values to My Null

My Null

Prerequisites

To complete the procedure, you need the following:

  • An ASP.NET Web project with a WebDataGrid instantiated on a web page

  • The WebDataGrid bound to a SqlDataSource component and configured to retrieve the CustomerID , CompanyName , ContactName , and ContactTitle fields from the Customers table of the Northwind sample database. (For details, see the Getting Started with WebDataGrid topic.)

Configuring the text for the null values using the designer

To set the NullValueText to My Null on WebDataGrid using the Designer:

1. From the smart tag of the WebDataGrid, open the WebDataGrid Designer.

WDG ExcelStyleFiltering Configuring CE 4.png

2. From the left pane, select the desired filtering behavior.

3. From the right pane, set the NullValueText property to My Null .

4. Click the OK button.

Configuring the text for the null values in the ASPX markup

The following code demonstrates how to set the NullValueText of the WebDataGrid to “My Null” in the markup.

In ASPX:

<Behaviors>
    <ig:Filtering FilterType="ExcelStyleFilter" NullValueText="My Null">
    </ig:Filtering>
</Behaviors>

Configuring the text for the null values in the code-behind

The following code demonstrates how to set the NullValueText of the WebDataGrid to “My Null” in the code behind:

In C#:

//Create a Filtering Behavior
this.WebDataGrid2.Behaviors.CreateBehavior<Filtering>();
//Set Filtering Behavior to Excel Style Filter
this.WebDataGrid2.Behaviors.Filtering.FilterType =
    Infragistics.Web.UI.GridControls.FilteringType.ExcelStyleFilter;
//Set the NullValueText property to "My Null"
this.WebDataGrid2.Behaviors.Filtering.NullValueText = "My Null";

Related Content

Topics

The following topics provide additional information related to this topic:

Topic Purpose

This topic provides reference information about the properties that are specific to the Excel-Style Filtering feature of the WebDataGrid control.

Samples

The following samples provide additional information related to this topic.

Sample Purpose

This sample demonstrates using of the the Excel-Style Filtering’s UniqueValueCasing property.

This sample demonstrates Excel-Style Filtering with Bound and Unbound fields as well as with Bound and Unbound checkboxes.

This sample demonstrates h the NullValueText property of the Excel-Style Filtering, setting the string to Null .

This sample demonstrates Excel-Style Filtering with editing.