dataviewmanager problem

  • Thread starter Thread starter joe pribele
  • Start date Start date
J

joe pribele

sorry for the repost i just want this to be its one thread.

Please tell me what I am doing wrong.

I have the following DataTables
Establishments (Id, <other stuff>.... )
Bookings ( estabId, <blah>.... )

I created a DataSet with a relationship between id and estabid. This
all works great. Now I want to filter by Id. So I did the following.

dataSet.DefaultViewManager.DataViewSettings["Establishments"].RowFilter
= "Id=1";

This works for filtering the Establishment table.

Trace.Warn( dataSet.Tables["Establishments"].DefaultView.Count+"" );
prints out 1 like it should

However
Trace.Warn( dataSet.Tables["Bookings"].DefaultView.Count+"" ); prints
out 10 which is the total number of rows in Bookings.

I thought the DataViewManager is suppose to work with the
relationships ? The whole point of this is that I want to get a view
 
Hi Joe,

I am not sure to understand your problem.
You are filtering the rows in Establishments table and you expect that the
rows in Bookings table are filtered too?
 
Yes. Isn't that the point of the DataViewManager ?

Joe

Miha Markic said:
Hi Joe,

I am not sure to understand your problem.
You are filtering the rows in Establishments table and you expect that the
rows in Bookings table are filtered too?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

joe pribele said:
sorry for the repost i just want this to be its one thread.

Please tell me what I am doing wrong.

I have the following DataTables
Establishments (Id, <other stuff>.... )
Bookings ( estabId, <blah>.... )

I created a DataSet with a relationship between id and estabid. This
all works great. Now I want to filter by Id. So I did the following.

dataSet.DefaultViewManager.DataViewSettings["Establishments"].RowFilter
= "Id=1";

This works for filtering the Establishment table.

Trace.Warn( dataSet.Tables["Establishments"].DefaultView.Count+"" );
prints out 1 like it should

However
Trace.Warn( dataSet.Tables["Bookings"].DefaultView.Count+"" ); prints
out 10 which is the total number of rows in Bookings.

I thought the DataViewManager is suppose to work with the
relationships ? The whole point of this is that I want to get a view
 
Hi joe,

joe pribele said:
Yes. Isn't that the point of the DataViewManager ?

Not really. DataViewManager lets you specify a default view per table. It is
useful if you bind the dataset to a grid for example.
But you won't find there what are you looking for.
You will have to set RowFilter on both tables...
 
Back
Top