0
votes

1- I have an ASPXGridView on my page.

2- I use linq to sql query as my data source.

3- I merge two different table data. One table has more columns than the other. I create an anonymous type and create the missing columns for the table with less number of columns and initialize those added columns to empty string.

4- When page loads, grid is loaded with data as it should.

5- There is a header filter for all columns.

6- When I expand header filter. I see all possible filters including empty string.

7- When I select empty string and hit OK, then the grid is not filtered and it stays the same.

8- When I expand the header filter again, I see that my check on empty string is gone.

What should I do in order to be able to filter by empty string?

1

1 Answers

0
votes

I found the answer in the link below.

http://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewGridViewDataColumnSettings_HeaderFilterModetopic

Also as an additional information.

In linq query

Let's say we have table 1 and table 2.

Table 1 It has columns a,b,c

Table 2 It has columns a,b,c,d,e

In the grid I want to merge data from both table. Since Table 1 lacks columns d and e, in linq i create an anonymous type and initialize d and e to string.empty.

This caused the empty header filter pop up entry. When I tried to filter by it it didn't work and when I reopened the filter pop up, it was unchecked.

I initialized columns d and e to null as string, then the empty entry disappeared.

new { a = data, b= data, c = data, d = null as string, e = null as string}