Hi
I am currently evaluating LLBLGenPro and using it to create a simple Windows Forms UI to display information from a single table in a DataGridView. Most of the columns are FKs to other "lookup" tables.
To allow the user to filter the data displayed, I also have a number of ComboBox objects, one for each FK column displayed in the grid. The ComboBox objects are simply populated using the generated Entity Collection for the relevant lookup table, which is then databound to the ComboBox to show all the available values. The idea is the user then selects values in the comboboxes and the grid is refreshed to only display rows with that value in the corresponding column. (Similar to thread http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=6363)
Originally I was using some hand-coded data access code to populate the comboxes. One of the advantages of this was that I was able to explicitly add a "<All>" entry as item 0 in each Combobox, allowing the user to choose "<All>" to specify they dont want to filter on that column i.e. rows with any value for that column will be displayed.
However, I am now using LLBLGenPro-generated code and databinding to populate the ComboBoxes. Since the comboxes are databound, the SelectedItem() property always returns a value (even if its just the first one in the list), effectively meaning that a value is always "selected" for each combobox, resulting in a filter being applied for every single column.
What I need is some means of including the type of "<All>" entry I previously had (or even just a blank entry) as the first in the list. However:
- I cant manually add entries to the ComboBox any more: once you set the .DataSource property of the ComboBox, any attempt to manually tinker with items causes an exception.
- I cant just add a dummy "<All>" entry to the Entity Collections I am using for databinding: Even if I could avoid this resulting in a new row being created in the DB, I couldn't always get the text to display "<All>' e.g. for numeric columns etc
- Similar to a solution offered in thread 6363 above, I am thinking I could somehow alter the generated SELECT statement that populates each ComboBox Entity Collection to include some sort of UNION statement so that they all have a "<All>" entry as item 0. However, that seems like a nasty hack and even then I have no idea how I would go about doing that.
So, is there any way to accomplish what I want, without having to resort to adding a corresponding 'Filter On This Field' checkbox for every combobox?
I am using SelfServicing, LLBLGenPro version 2.0.0.0 DEMO, .NET 2.0, C#, SQL Server 2000.
Thanks heaps
Cheers
Brett