I'm sure that one way or another it can be done, but with the level of complexity it will probably require, you could already be done with the classes.
The classes would probably be easier to maintain as well. As far as the "trouble" of writing the classes, I've found that once you have one set of classes of this type as a template, duplicating it can be done very quickly. The collections class will be virtually identical from implementation to implementation, it's only the actual row class that is unique to the implementation, and that's simply a bunch of properties that return the appropriate datacolumn value. These can be created very quickly, as there is next to no logic behind them. The only tricky part is to implement your filtering on the constructor of the collection class. William Alexander Software Developer ----------------------------------------------- DATATRAK International, Inc. 6150 Parkland Blvd. Suite 100 Mayfield Heights, OH 44124 P - (440) 443-0082 F - (440) 442-3482 -----Original Message----- From: Wyssocky, Lidor [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 1:04 PM To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Filtering Data in Complex DataSets Thanks for the fast response but I have one comment about this scheme: I don't think it is worth all the trouble of writing those classes, if they don't have any added value except present the data in the grid. I believe that the connectivity between a data view and a control should support a not too complex filtering as I'm trying to do. I agree, however that for more complex scenarios, where there's a "real" business logic to implement, writing a class that represents the data is the right thing to do. So you claim that there isn't a way to achieve this filtering from the standard ADO.NET classes? Thanks, Lidor Lidor Wyssocky Software Infrastructure and Tools NDS Technologies Israel E-Mail: [EMAIL PROTECTED] Phone: 972-2-589-4801 Fax: 972-2-589-4900 -----Original Message----- From: Alexander, William [mailto:[EMAIL PROTECTED]] Sent: Sun, June 23, 2002 17:28 To: [EMAIL PROTECTED] Subject: Re: [ADVANCED-DOTNET] Filtering Data in Complex DataSets Considering the complexity of what you're trying to do, perhaps you should encapsulate this data in a class. There are many ways to do this. I'll describe one. Create a class called "Thingy". Give this class properties for all the data elements you wish to display or manipulate in the Grid. These data items that Thingy exposes will eventually become a row in your DataGrid. Now create a second class called "Thingies" that inherits from System.Collections. On the constructor of this class, accept some sort of filtering criteria. This class must also inherit from IEnumerable, and implement it's interface. This is what permits the DataGrid to bind to this class. Thingies will be a collection of Thingy objects. Now you can bind your DataGrid to the "Thingies" collection, and pass your filter criteria at the same time. Inside of the Thingies class, you can do anything necessary to massage you data to the point where you can create an individual "Thingy". Just remember, after DataBinding, the data that the DataGrid will display are properties of the Thingy object. Also, you could also nest another databound list control inside of the datagrid quite easily by having one of the properties of the Thingy object be a collection of some type. An array of any type would do. You could even us an array of "Thinglet" objects if you liked. I realize that this may be a bit confusing. It's a big subject to cram into a few paragraphs, but I use these methods every day, and I find them faster, and a lot more powerful than simply binding to DataTables. I can send you some source if you like. William Alexander Software Developer ----------------------------------------------- DATATRAK International, Inc. 6150 Parkland Blvd. Suite 100 Mayfield Heights, OH 44124 P - (440) 443-0082 F - (440) 442-3482 -----Original Message----- From: Wyssocky, Lidor [mailto:[EMAIL PROTECTED]] Sent: Sunday, June 23, 2002 3:39 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Filtering Data in Complex DataSets Hi, I encountered the following problem when trying to present a DataSet in GridView control: My DataSet contains several tables with relationships between them. For example, Table Students contains a link to Table Countries. Now, I want to filter students by the country value. I tries to use the DataView and the DataViewManager class, but all I could find is the RowFilter property. As far as I understand, this property can't be used to filter a field which is in fact a relationship to another table (or at least I don't know how to do so). I should also note that I'm note working with a physical data base, so I can't create an SQL query that will populate the dataset with the filtered data. I want the dataset to contain the complete data, and use a filter only on the view level. Does anyone knows how can I create such a filter with one of these classes, or in another way? Thanks, Lidor Lidor Wyssocky Software Infrastructure and Tools NDS Technologies Israel E-Mail: [EMAIL PROTECTED] Phone: 972-2-589-4801 Fax: 972-2-589-4900 You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.