I allow my customers to save layouts on every grid and it loads the layout when they go to the specific grid.
My problem is that when I use a custom filter on a money column and use "Greater Than" and "0", it works fine right then, but when the grid loads the layout on the next opening of the grid, the filter is not properly applied. There are no rows in the grid even though I have hundreds of records that are greater than Zero. If I clear the filter, all the rows show up.
Thanks in advance.
There's not really enough information here for me to guess what's happening.
What exactly is happening when you reload the grid? Are you setting a new data source? Loading the layout?
Also, what version of the controls are you using?
Can you reproduce the problem in a small sample project?
My best guess is that the filter being loaded is somehow corrupted. Like maybe you are setting some filtering in the InitializeLayout event after the load occurs and this is causing the same filter to be done twice or something like that. You could examine the ColumnFilters for each column in the grid after you load the layout and see what's in there that is resulting in all of the rows being filter out.
here's how I load the grid
dCom.CommandText = "Select GridLayout from MarketplaceDefaultGridLayouts where GridName = '" & GridName.Replace("'", "''") & "'"
dr = dCom.ExecuteReader(CommandBehavior.SingleResult)
If dr.Read Then
Dim data() As Byte
data = dr(0)
ultragrid.DisplayLayout.Load(New System.IO.MemoryStream(data), Infragistics.Win.UltraWinGrid.PropertyCategories.All)
The loading of the grid happens after the datasource is set.
A grid that has over 100 rows with the filter saved as Backlog > 0 in a custom column filter (your custom filtering using excel column filtering) then reloads and has no rows.
does that make more sense?
Well, since I am not sure what dcom is, it's hard to tell if what you are doing here will work. It's possible that whatever you are doing with the saved layout data is somehow corrupted it. Saving the stream to a byte array can be tricky.
Also, I'm not sure what you mean by a custom filter. What do you mean by "custom?" Are you creating your own derived FilterCondition classes?
We're probably going to need to see a sample project so we can debug it in order to assist you with this, because it sounds like this is much too complex to just describe in a forum post.
dCom is a sqlclient.sqlcommand
I save the layouts in the database as a blob. When the user opens the grid of the name that the layout is saved for, it loads it into the grid from the database. I have never had a problem with this before (I've been doing this for many years now). We have tried saving a new layout as well, so I don't know how each of them can be corrupt.
By custom filter I mean I use the excel style filtering on the column (a money column called backlog) and use the custom filtering built into the excel style filtering and choose "Greater Than >" from the drop down and set the value to "0"
Have you tried my suggestion of examining the ColumnFilters in the grid after you load the layout to see if they are correct?
Other than that, I'm not sure how I can assist you with this. If the filters are not working, either they are being loaded incorrectly (they are corrupt) or something in your application is applying additional filters you are not aware of. Or there's a bug in the grid. But without a sample demonstrating the problem, there's no way I can divine what the issue is.
If you take a look at the ColumnFilters collection and see what's in there, it might give you a clue as to what the actual filters are and why no rows are displaying.