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

GridDataBoundGrid & GridFilterBar - refresh

Hi, I''m associating a GridFilterBar on a GridDataBoundGrid control. In one column of the GridDataBoundGrid, i have some numeric values. I need to calculate the sum of this column based on the filter criteria. I have used the GridFilterBar_TextChangedEvent. It always shows the sum of the columns of the grid before the filter is applied. Ex: Grid Columns: Filter condition = null Cash 10 30 40 50 60 100 110 Initially Sum:400 Say a filter is applied like Cash >= 100 The column is now: Cash 100 110 The sum : 400 Say a filter is applied Cash > 100 The column is now: Cash 110 But the sum : 210 which is the previous columns based on the filter criteria Cash >= 100. I want to do the total after the criteria is applied, after the values are displayed in the grid. On which event do i perfom such a total. Request you to help at the earliest.

1 Reply

AD Administrator Syncfusion Team May 26, 2004 06:36 AM UTC

Try catching the ListChanged event on the underlying DataView and look for ListChangedType.Reset. CurrencyManager cm = (CurrencyManager)this.gridDataBoundGrid1.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember]; DataView dv = (DataView) cm.List; dv.ListChanged += new ListChangedEventHandler(dv_ListChanged); The handler.
private void dv_ListChanged(object sender, ListChangedEventArgs e)
	if(e.ListChangedType == ListChangedType.Reset)
		//do your sum

Live Chat Icon For mobile
Up arrow icon