LeaderBoard

Filtering a DataSet from Code behind

Enterprise portal allows filtering the list pages using the Filter control available on the EP Grid.

The Filter control provides a UI to select the field, criteria and the values you want to filter the grid.

It is also possible to add multiple conditions.

image

But there may be scenarios where you want to use your own controls to filter the grid or the underlying DataSet.

The EP framework provides the following classes to do this –

- FilterObject

- ConditionType

Let’s look at how we can do the filtering from code behind.

1. Add a Filter to list only the Customer whose name that starts with “Light”

clip_image004

2. Using Between operator – Between operator is a special case. There are two ways to use the Between operator -

a. Using – value..value

clip_image006

b. Using – valueCollection class

clip_image008

3. How do I use more than one condition -

clip_image010

4. Filter on a date – which format should a date be in? Is there a single format which can always be used?

When using the Filter control available in EP Grid, the date will be in user regional settings.

But when using from the code behind, the IIS server’s regional settings will be applicable.

So if the regional settings on the IIS are ‘MM/DD/YYYY’ the date value must be specified in ‘MM/DD/YYYY’ format.

clip_image012

No comments:

Post a Comment