Databinding

quwiltw

Contributor
Joined
Sep 18, 2001
Messages
486
Location
Washington, D.C.
I'm binding to a dataset with the datamember being the tablename. The problem is that it doesn't seem to respect the DefaultView of the datatable. I need the datasource to be at the dataset level so I can't directly set it to the view. I've ensured that I'm consistently referencing the DataSource/DataMembers properly. The problem is that it doesn't recognize when I apply a filter to the default view of one of the tables. Anyone have any clue why?
 
I think you'd have to bind to the DataView to have the binding work on the view. It seems like you'd want all of your controls to bind to the DataView though, right? Meaning, you say you're binding all controls consistently, so why not bind them all to the DataView?

I have used DataViews on tables to bind different controls to different views and it works pretty nice. Meaning, if you have the need to bind some controls directly to the table and some to a filtered view of the table, you can bind both ways.

But maybe I'm misunderstanding what you're trying to do. :)

-Nerseus
 
Binding to the views directly works fine in Form view but (much like Access) I have to flip into Datasheet view (using UltraGrid). To do this properly I think I need to set the datasource of the grid to the dataset so that it'll recognize the DataRelations properly. The problem comes in when I want to apply a filter to the DefaultView of one of the datatables, the grid doesn't respect it. That make any sense? I guess I would just expect that if a filter is applied to the DefaultView of a DataTable, then *all* subsequent access to that DataTable should respect the DefaultView? That wrong to expect? Any other ideas on how to solve this?
 
I've seen the same behavior as you. Meaning, a DefaultView is not the ONLY view into the table, just a default GridView in case you want one. I use a grid by DevExpress and it has a similar problem. For it, I can bind the parent table to a specific table or a view, including ds.Tables[0].DefaultView, and it respects the filtering of the DefaultView even if I chance the RowFilter later in code. Unfortunately, in the grid I use, there's no way to get child tables to filter.

Maybe try setting the grid's DataSource to the DefaultView property?

-ner
 
Yeah, if I do that it works and if I set the Datasource directly to the DataTable it respects it, but I have to only set datasource to the dataset because I need the different bands based on the relations to show up too. I finally took the incident hit and called Infragistics, they've taken it on as a bug. We've found a few others and they usually have them fixed in the next hotfix, so hopefully it's the same with this. For now, I'm using the filtering model of the UltraWinGrid.
 
Back
Top