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

FILTER PROBLEM

27 Answers 1036 Views
GridView
This is a migrated thread and some comments may be shown as answers.
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
JOSE MANUEL PÉREZ RAMÍREZ asked on 21 Apr 2008, 07:33 AM
i can not set filter (Contains, start with...) in radgrid.

i think radcontrols avanced tutorial is necesary to consolidate this product.

27 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 21 Apr 2008, 03:07 PM
Hello Jose,

Thank you for contacting us.

Please provide us with additional details on the particular use case. What is the type of column that you're setting the filter to? Is this in bound or unbound mode?

Please keep in mind that the "Contains" & "Starts with" functions are only applicable on text columns.

All the best,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
answered on 22 Apr 2008, 06:19 AM
this code can not run in 2008 Q1. I need to set filter.

(2007 Q3 code)
gridViewTextBoxColumn2.Filter.Function = Telerik.WinControls.UI.

GridKnownFunction.StartsWith;

how in 2008?

0
Dwight
Telerik team
answered on 22 Apr 2008, 07:05 AM
Hi JOSE,

The filtering functionality of RadGridView has been extended to allow application of multiple conditions on a single field (column).


Here is a code snippet that changes the user's filter function:

FilterExpression filter = new FilterExpression(FilterExpression.BinaryOperation.AND, GridKnownFunction.StartsWith, GridFilterCellElement.ParameterName); 
 
this.radGridView1.Columns["City"].Filter = filter; 

If you need further assistance, do not hesitate to write us back.

Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
answered on 22 Apr 2008, 07:41 AM
Is possible to set in gridview designer. (Vs2005)...  same 2007 Q3??
0
Dwight
Telerik team
answered on 22 Apr 2008, 08:38 AM
Hello Jose,

Yes, you can use the designer to set the filter as well. Just add a predicate (if there is none) and set the predicate's filter function to the required one.

It is important to set the predicate's  parameter to "@FilterEditor1". This way you'll indicate that the predicate will use the user's input (the textbox below the column's header).

Contact me again with any other questions you have.

Regards,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
answered on 08 May 2008, 11:18 AM
i don't know reproduce about your reply. Can you explain it?
0
Jordan
Telerik team
answered on 09 May 2008, 01:47 PM
Hello JOSE MANUEL PÉREZ RAMÍREZ,

Let me clarify. Setting a filter expression to a column in design time is quite easy. If you use the filter editor, all the parameters will be set for you.

In order to set a filter to a column at design time, you have to just follow the steps below:
  1. Open the form in design time
  2. Select a RadGridView control
  3. Locate in the property grid the MasterGridViewTemplate property and expand it
  4. In the expanded properties under the MasterGridViewTemplate in the property grid, locate the Columns collection and open the collection editor for it
  5. Locate the desired column in the collection editor
  6. In the property grid on the left, locate the Filter property for the selected column and open the filter editor for it
  7. Set the desired filter expression
I hope this helps.

Best wishes,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
answered on 12 May 2008, 06:23 AM
Sorry i don't explain correctly.
In example, I want to set filter to "contains" for usability and don't specify the predicate (user set it). in this case the filter don't save it.
In Q3 2007 i can set it without predicate, and the filter pre-set in contains, start of, ... .

very thanks
0
Jordan
Telerik team
answered on 12 May 2008, 11:56 AM
Hi JOSE MANUEL PÉREZ RAMÍREZ,

In Q1 2008, the Contains filter function is default for the string type, so you do not have to set it. Also, in 2008 Q1 Service Pack 1, that is due in the middle of this month, you will be able to change the filter function without setting the parameter.

Greetings,
Jordan
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Faisal
Top achievements
Rank 1
answered on 18 Nov 2008, 06:54 PM
Jordan mentioned that:
"In Q1 2008, the Contains filter function is default for the string type, so you do not have to set it"

I am having trouble with filters on decimal fields. When I set them using the property build to Equals, they work fine once. But then they get reset to 'No Filter' automatically when I rebuild my solution after making other unrelated changes to the grid. Is this a bug in RadGridView? Is there a way to force them to stay intact. I have a lot of columns and everytime I make any changes, the filter revert back to No Filter on the decimal fields.

How can I force set them in my C# code?

Thanks,
Faisal
0
Jordan
Telerik team
answered on 20 Nov 2008, 03:01 PM
Hi Faisal,

Which release of RadControls for WinForms are you using? In the last release (Q3 2008) quite a lot of fixes were made to the RadGridView property builder. Also the "Equal To" filter function is now default for the decimal and DateTime types.

And to be sure that your filter settings are not overridden by the designer you could set them yourself as in the Filtering example for RadGridView.
 

Best wishes,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Faisal
Top achievements
Rank 1
answered on 20 Nov 2008, 03:49 PM
Thanks.

I am using Q2 2008 SP1. The filters I am referring to are the ones that appear right below the header row for each column. The default for the the decimal field is 'No Filter' and even when I set it in the property builder, it reverts back to 'No Filter'. The default for integer types seems to be 'Equals' which is what you are referring to; however, I have doubles in there as well where filter default of 'Equals' does not seem to work.

The example that I found in the online documentation is at http://www.telerik.com/help/winforms/grid_setting-filters-programmatically.html. However, this does not seem to override the 'No Filter' action either.

Is this issue fixed in Q3 2008?

Thanks,
Faisal
0
Jordan
Telerik team
answered on 21 Nov 2008, 08:37 AM
Hi Faisal,

That code from the documentation:

filter.Predicates.Add(FilterExpression.BinaryOperation.AND,
   GridKnownFunction.StartsWith,
   GridFilterCellElement.ParameterName);

should change the filter function to "Starts With" (for a string column). If you are still experiencing problems, then you have hit a bug that was fixed in the Q3 2008 release. In this case I would suggest using Q3 2008.

 
All the best,
Jordan
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Visakh
Top achievements
Rank 1
answered on 08 Nov 2019, 04:52 AM

Hello,

Am using filter option when the radgridview is being updated(adding rows one by one), but i could not able to use the filter box as it is getting disappered before entering the text. Because the grid is getting refreshed when adding rows. Also am doing scroll to last row. 

But then how to do filtering when doing the above operation.

0
Dimitar
Telerik team
answered on 08 Nov 2019, 09:45 AM

Hello Visakh,

I would recommend using the new AutoFilterDelay or implement "Filter on Enter". This way you can perform the filtering operation after the user has finished typing: 

radGridView1.Columns[0].AutoFilterDelay = 3000;

I hope this helps. Please let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Visakh
Top achievements
Rank 1
answered on 09 Nov 2019, 10:05 AM

Hi Dimitar

I have the below control setup in my code 

> It is a RadGridView

> I am updating the data dynamically in a constant rate 

> Also am scrolling to the end of the RadGridView when I add the data

> Now in between if I use the RadGridView filter built in, and if start to type somthing to search/ filter the text is getting disappeared

I want to avoid this 

Do you have a solution ?

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 12 Nov 2019, 10:31 AM
Hello, Visakh, 

According to the provided information, it is not very clear whether you are using the filtering functionality or the search option. When you filter the grid, it create FilterDescriptors objects that are added to the grid. Then, if you call MasterTemplate.Refresh it is not expected to lose the filtering. In the other case, if you enable the search row and type something in the search text-box, refreshing the MasterTemplate won't lose the search box value. 

Do you perform rebinding the RadGridView? I have attached my sample project which result is illustrated in the attached gif file. Am I missing something? Could you please specify the exact steps how to reproduce the problem you are facing? Once we replicate the undesired behavior locally, we would be able to think about a suitable solution. Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Visakh
Top achievements
Rank 1
answered on 13 Nov 2019, 07:13 AM

Hi Dess,

Am using filter functionality. I have attached gif file to show the problem am facing. I could not able to type in anything to filter box, it is getting out of focus within a second. again i need to click there to type in, its annoying.

Thanks.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Nov 2019, 12:51 PM

Hello, Visakh,    

The provided gif file is greatly appreciated. It helped me to understand better the precise case. Actually, the illustrated behavior shows that the editor for the filter cell is closed after refreshing. This is expected behavior after a refresh operation. In order to activate the editor again, you can follow the demonstrated approach in the following help article: https://docs.telerik.com/devtools/winforms/controls/gridview/filtering/put-a-filter-cell-into-edit-mode-programmatically 

It is important to note that it is necessary to force refreshing the layout by calling Application.DoEvents method: 
        private void timer1_Tick(object sender, EventArgs e)
        {
            this.radGridView1.MasterTemplate.Refresh();
            Application.DoEvents();
            this.radGridView1.MasterView.TableFilteringRow.Cells[this.radGridView1.CurrentColumn.Name].BeginEdit();
        }
I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Visakh
Top achievements
Rank 1
answered on 15 Nov 2019, 05:29 AM

Hi Dess,

Thank you for the reply. Your reply helped to understand more better.

Am not doing any refresh using Refresh command. Can u look at the code and tell which line is making the grid to get refreshed.

I tried commenting out BeginUpdate, EndUpdate and also ScrollToRow. Whether adding the row to grid itself makes refresh operation internally?

 private void timer1_Tick(object sender, EventArgs e)
        {
            radGridView1.BeginUpdate();

            CurrentCount = messagesList.Count - previousCount;
            for (int i = previousCount; i < messagesList.Count; i++)
            {
                var msg = ((TraceMessage)messagesList[i]);
                if (msg == null) continue;
                if (radGridView1.Rows.Count == 501)
                {
                    radGridView1.Rows.RemoveAt(0);
                }
                if (_databaseParser != null)
                    radGridView1.Rows.Add(msg.Time, msg.CanId.ToString("X"), msg.MessageIndication, msg.Length, msg.DataString, _databaseParser.GetMessageById(msg.CanId) != null ? _databaseParser.GetMessageById(msg.CanId).Name : "");
                else
                    radGridView1.Rows.Add(msg.Time, msg.CanId.ToString("X"), msg.MessageIndication, msg.Length, msg.DataString);
            }

            previousCount = messagesList.Count;

            radGridView1.EndUpdate();

            if (radGridView1.Rows.Count > 0)
                radGridView1.TableElement.ScrollToRow(radGridView1.Rows.Last());

            //Application.DoEvents();
            //this.radGridView1.CurrentColumn.Name
            //this.radGridView1.MasterView.TableFilteringRow.Cells[1].BeginEdit();
        }

Thanks.

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 15 Nov 2019, 12:18 PM
Hello, Visakh,

Using a BeginUpdate/EndUpdate block suspends refreshing the layout while you are adding rows to RadGridView. It will optimize performance since only one refresh operation will be performed after calling EndUpdate. That is why you need to force entering edit mode after the EndUpdate method is called. It is actually the commented part at the bottom of the provided code snippet.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jay
Top achievements
Rank 1
answered on 09 Dec 2019, 05:05 PM

Hello all,

I am trying to utilize filters on a GridViewTextBoxColumn using C# in Visual Studio Professional 2015 and Telerik 2019.3.917.40, but I am not seeing the filters limit my data. I have tried this both in code and interactively in the UI.

Is there an event that I need to connect to get the UI to refresh with the filter applied?

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Dec 2019, 09:39 AM
Hello, Jay, 

By default, if you add a new FilterDescriptor to RadGridView or enter a filter criteria in the UI, the grid is refreshed instantly and displays only the rows that matches the filter criteria.

If you need to detect when a filter is applied to RadGridView, you can subscribe to the RadGridView.FilterChanged event. The RadGridView.FilterDescriptors.Expression property will give the filter expression that is applied to the grid.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jay
Top achievements
Rank 1
answered on 11 Dec 2019, 01:42 PM

Dess,

I am not seeing the grid data refresh when I enter data interactively or when I apply a FilterDescriptor.

I attached a screenshot of my UI after I entered a filter via the grid to show that the data is not filtering, along with a screenshot of the columns editor for the grid in question.

Below is also a code snippet of how I am trying to apply the filters via code.

private void radCheckedDropDownList1_ItemCheckedChanged(object sender, Telerik.WinControls.UI.RadCheckedListDataItemEventArgs e)
{
    FilterDescriptor filter = new FilterDescriptor();
    filter.PropertyName = "MessageSource";
    filter.Operator = FilterOperator.StartsWith;
    filter.Value = e.Item.Text;
    filter.IsFilterEditor = true;
    gvOpenMail.FilterDescriptors.Add(filter);
}
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 Dec 2019, 09:51 AM
Hello, Jay,    

Following the provided information, I was unable to reproduce the issue you are facing. Please refer to the attached gif file illustrating the behavior on my end with the specified version. I have attached my sample project. Am I missing something? Could you please specify the exact steps how to reproduce the problem? Do I need to perform any changes in oрder to replicate the undesired behavior that you are facing? Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Jay
Top achievements
Rank 1
answered on 13 Dec 2019, 01:31 PM

Dess,

The main difference I see between your sample and my code is that I am setting the DataSource property of the RadGridView control to be a List<CustomClass> versus your DataTable.

As far as steps to replicate the problem, I have attached a short clip of me demonstrating the issue.

Below is the code for my custom class.

public class MessageSort
{
     public int MessageId { get; set; }
     public string MessageSource { get; set; }
     public DateTime? ReceiveDate { get; set; }
     public bool PriorityFlag { get; set; }
     public bool? Tracked { get; set; }
     public int TotalPages { get; set; }
     public int? ProcessedPages { get; set; }
     public string ProcessBy { get; set; }
}
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 16 Dec 2019, 07:40 AM

Hello, Jay,    

Indeed, the provided gif file illustrates incorrect behavior when applying the filter on your end. Following the provided information, I have modified my sample project to use a list of custom objects. 

It seems that the filtering works as expected on my end. Please refer to the attached gif file illustrating the behavior on my end. Am I missing something?

I have attached my sample project. Could you please specify the exact steps how to reproduce the problem? Feel free to modify it in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
Answers by
Dwight
Telerik team
JOSE MANUEL PÉREZ RAMÍREZ
Top achievements
Rank 1
Jordan
Telerik team
Faisal
Top achievements
Rank 1
Visakh
Top achievements
Rank 1
Dimitar
Telerik team
Dess | Tech Support Engineer, Principal
Telerik team
Jay
Top achievements
Rank 1
Share this question
or