In the pages data source there is a Field called Filter Name. To apply a filter to a data source, you just enter the control ID of the filter web part in that field in the data source web part. When creating the filter, if you havent already, take a look at the documentation
The key things here are
this.WhereCondition = where;
this.RaiseOnFilterChanged();