You can check if the FilterCommand is fired and set a boolean variable. Then in the PreRender event of the grid check if the boolean variable is set and retrieve the count of the items in the grid. The following examople should help you understand better:
c#: