-1

I have a Dynamic-Data application with a List.aspx main page listing data which can be filtered by country. The country table is used as a DynamicFilter as it is a foreignkey to the main table.

When I choose a state the DynamicFilter_FilterChanged method fires and it filters the main table properly but I'm trying to figure out how I can get the total number of rows that the filtering has produced.

I've looked at previous posts here with no luck.

Any ideas?

DevilDog
  • 413
  • 2
  • 7
  • 16

1 Answers1

1

You can count when the Gridview on the list.aspx page is selected

protected void GridDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e)
{
    if (e.TotalRowCount > 0)
    {
        lblCount.Text = e.TotalRowCount.ToString() + ((e.TotalRowCount == 1) ? " item found." : " items found.");
    }
}
Ash Machine
  • 9,601
  • 11
  • 45
  • 52
  • When does this method fire? I added this code and when I click the Country drop-down list and select a country the GridView gets filtered properly but this method never fires. – DevilDog Dec 11 '12 at 17:51
  • Sorry, wasn't included. This fires on the OnSelected Event on the LinqDataSource (or whatever data source) that populates the Gridview. – Ash Machine Dec 12 '12 at 21:34
  • I guess the Gridview datasource is not being selected because this method "GridDataSource_Selected" is not being fired? – DevilDog Dec 14 '12 at 21:36
  • Do you have OnSelected="GridDataSource_Selected" in your LinqDataSource tage? – Ash Machine Jan 09 '13 at 21:04