dataviewmanager problem

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
 
M

Miha Markic [MVP C#]

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?
 
J

joe pribele

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
 
M

Miha Markic [MVP C#]

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...
 

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