We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to fire an event after filtering GDBG?

I added a gridFilterBar to a GDBG. Now I want to show a message of currentcell after filtering. Which event should I fire? The filterbar.FilterBarTextChanged event is fired before the GDBG is filtered.

3 Replies

AD Administrator Syncfusion Team February 18, 2005 05:03 AM

Right now there is no event raised after the filter. We will add one. For the time being, to catch this action, you would need to derive GridDataBoundGrid and override OnCurrentCellClosedDropDown. In the override, call the base class, and then you could do your ''after filter'' work as the filtering is completed by this time. Or, you could raise an event at this point so any listener to the event could act on your custom "AfterFilter" event. Here is a derived class:
 public class MyGridDataBoundGrid : GridDataBoundGrid
 {
	protected override void OnCurrentCellCloseDropDown(Syncfusion.Windows.Forms.PopupClosedEventArgs e)
	{
		base.OnCurrentCellCloseDropDown(e);
		if(this.CurrentCell.RowIndex == 1) //filter row
		{
			Console.WriteLine("After filter, there are {0} rows in grid.", this.Model.RowCount);
		}
	}
 }


FL Frank Lin February 20, 2005 02:28 AM

Hi,Clay Thanks for your answer. Actually, the GDBG OnCurrentCellCloseDropDown event isn''t overridable. There is an error to override Protected Overrides Sub oncurrentcellclosedropdown(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.PopupClosedEventArgs). Is there any other solutions? Actually, it''s absolutely necessary in my applicaton to fire an event and calculate remaining records after filter.


AD Administrator Syncfusion Team February 20, 2005 07:35 AM

That method is overridable. Here is a class that I added to the FilterBarSample and it worked as expected for me. Imports Syncfusion.Windows.Forms.Grid Public Class MyGridDataBoundGrid Inherits GridDataBoundGrid Protected Overrides Sub OnCurrentCellCloseDropDown(ByVal e As Syncfusion.Windows.Forms.PopupClosedEventArgs) MyBase.OnCurrentCellCloseDropDown(e) If Me.CurrentCell.RowIndex = 1 Then '' filter row Console.WriteLine("After filter, there are {0} rows in grid.", Me.Model.RowCount) End If End Sub End Class If you do not want to do this, you can wait until the next release (I do not know when it will be available, but it is in the works). We have added an event, FilterBarFilterCompleted, that is raised after the filter has been completed.

Loader.
Live Chat Icon For mobile
Up arrow icon