This is a migrated thread and some comments may be shown as answers.

RadGrid Change Filter NotEqualTo

3 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
guillaume.lebel asked on 17 Mar 2009, 12:52 PM
I'm trying to change the NotEqualTo filter to be able to return any record that have no value. I mean when i tried to filter a row it return only the row who that have some value in, all the other row are not displaying.

Is there a way to change the NotEqualTo filter to return also the null record?? or i have to create a custom filter?

Thank you and have a nice day!

3 Answers, 1 is accepted

Sort by
0
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
answered on 17 Mar 2009, 01:31 PM
Also i'm having an other problem with RadGridFiltering and Pagin. When i try to filter record that are displaying on more thant 1 page, the result aren't displaying all on the same page. Exemple i have 30 record and each page are displaying 25. After i've filter my records i got 7 result but 4 are on the first page and 3 are on the second.

Is there any way to get the result in the same page??

Have a nice day!

Guillaume
0
Georgi Krustev
Telerik team
answered on 20 Mar 2009, 01:02 PM
Hello Guillaume,

To show all records, even these with NULL value when NotEqualTo option is chosen, you need to handle binding of the grid by yourself. You can accomplish this task when OnItemCommand event is raised.
Here is a code snippet showing how to achieve this:
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == RadGrid.FilterCommandName)  
        { 
            GridFilteringItem item = e.Item as GridFilteringItem; 
            TableCell cell = item[((Pair)e.CommandArgument).Second.ToString()]; 
            TextBox textBox = cell.Controls[0] as TextBox; 
            string selectedValie = textBox.Text; 
 
            string choosedFilterOption = ((Pair)e.CommandArgument).First.ToString(); 
 
            //TODO: Generate thq SQL statement and retrieve all data 
            // RadGrid1.Rebind(); 
        } 
    } 

In connection with your last post:
You can show all filtered records in one page if you disable paging. The other option is to increase the page size to be equal to the number of the returned records. This can be done in the same place where you re-bound the grid - in the ItemCommand.

Sincerely yours,
Georgi Krustev
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
answered on 20 Mar 2009, 04:58 PM
Thx for your answer Georgi I'm giong to try it immediatly.

Have a nice day!

Guillaume
Tags
Grid
Asked by
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
Answers by
guillaume.lebel
Top achievements
Rank 1
Iron
Iron
Georgi Krustev
Telerik team
Share this question
or