BindingSource filter with ReportViewer

01 Mar

When binding a BindingSource to a ReportViewer after BindingSource.Filter, it doesn’t display filtered data. The ReportViewer still refers to the underlying data source of the BindingSource regardless of any filtering or sorting the BindingSource applies. It seems to be a bug in .NET. A simple walk around is using another BindingSource to be the bridge between the filtered BindingSource and the ReportViewer. Sample code as follows:

originalBindingSource.Filter = someFilterString
Dim tempBindingSource As New BindingSource(originalBindingSource, "")
Me.ReportViewer1.LocalReport.DataSources(0).Value = tempBindingSource
' ------------------------------------
Leave a comment

Posted by on March 1, 2012 in .NET, ADO.NET, VB, Winform



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: