Hello,
I have a question regarding the UltraWinGrid, and infragistics controls in general that may help me to solve the following problem.
I have two tables
a "Contacts" table with various fields, but the important one is:
ContactID (as integer)
A "distribution" table that contains the following fields
DistributionID (as integer)ContactID (as integer)FileID (as integer)
There is a one-to-many relationship between the Contacts (1) and Distribution (many) table. The Distribution table has a unique constraint on {ContactID, FileID }, so that a file can be tied to a contact only once. The Files table (not shown) can contain several hundred definitions. Contacts will vary, but I expect maybe 20 or so.
I will want to show contacts for a single file at a time, so, for fileID = 1 I might have an UltraWinGrid like this (showing ALL available contacts):
SELECTED*
FIRST NAME
LAST NAME
EMAIL
TRUE
John
Doe
JDoe@bogus.com
FALSE
Jane
Jane.Doe@NotReal.com
Buck
BuckDoe@test.net
*The Selected Column would contain checkboxes.
To do this, I need to be able to filter the data on FileID so that I can display all contacts receiving a particular file. I want to be able to display ALL contacts, regardless of whether or not they have a reference in the distribution table, but indicate in the grid whether they are selected to get a file or not
At the app startup, I have ALL contacts, and ALL distribution data and won't be making subsequent calls to the database for each file selected.
I've tried a few different solutions that sort of work, but are very inefficient. I tried to create a new dataview using LINQ, but failed to get the resultset I wanted. Currently, I have the grid bound to the Contacts table. Whenever a user selects a file from the list, I filter the distribution table by fileID and then iterate through the contacts setting the "Selected" value accordingly. I feel like this is pretty klugy and I'm hoping there is a better way.
Are there any Infragistics 10.1 WinGrid features that will help me to accomplish this or am I just looking at this the wrong way. I feel like I'm overlooking a simple solution, but I'm tired of banging my head all by myself. Please feel free to join in and help me with a solution to this problem.
Thanks,Tony
I just needed a good nights sleep. I came in this morning and wrote a LINQ query that does what I need. I just have to reset the datasource and requery each time the user selects a file.