RowFilter - HowTo?

R

runningdog

Hi,

I have a DataGrid bound a DataSet containing a Number of tables.
The DataGrid contains a singles DataTableStyle mapped to one of the tables.

I would like to be able to dynamically constrain the DataTableStyle to a
subset of the rows in the DataSet.
Can RowFilter be used to do this is how?

TIA Steve
 
K

Kevin Yu [MSFT]

Hi Steve,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to dynamically constrain the
TableStyle of a datagrid to a subset of rows in the DataSet. If there is
any misunderstanding, please feel free to let me know.

Based on my understanding, TableStyle functions on tables and columns, it
doesn't care about what data values you're binding to. If you only need to
show a subset of data in a table which meets certain conditions, you can
use DataTable.DefaultView.RowFilter property to filter rows you need.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
R

runningdog

Thanks Kevin,

I've had a bit of a play with RowFilter without success and yes you have
understood my issue correctly.
I am currently tied up with some none-coding issues but I will let you know
how I get on with this next week.

Thanks again Steve
 
R

runningdog

Kevin

If have resolved my issue here.
The following example works

Friend WithEvents DS As WindowsApplication1.DataSet2
....

Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.DS.Customers
DS.Tables("Customers").DefaultView.RowFilter = "City ='London'"

But this does not work
Me.DataGrid1.DataMember = "Customers"
Me.DataGrid1.DataSource = Me.DS
DS.Tables("Customers").DefaultView.RowFilter = "City ='London'"
Data binding were generated the VS IDE Designer

But now I know it is not a problem.
Thanks Steve
 
K

Kevin Yu [MSFT]

Hi Steve,

It was nice to hear that you have had the problem resolved. Thanks for
sharing your experience with all the people here. If you have any
questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top