We have two bands. Depending upon a condition in each row of Band(0), we want to either show/hide a column on its Band(1) child rows.
Instead of hiding the column, simply setting the header text for the column to String.Empty would also work (we don't have to worry about the cells since they'll be empty anyways).
Is there any way to achieve this effect? The typical ways I'd solve this problem unfortunately hide the column across the whole grid, which is not what we want.
That pretty much solved it.
In the CreationFilter, once we got down to finding the column we want where we do the following:
parent.ChildElements.Clear() Return True
We had do some some other extra stuff to do it only for the subset we want.
Dim subbandRow = TryCast(headerUIElement.Parent.GetContext(GetType(UltraGridRow)), UltraGridRow) Dim rowWithCondition = subbandRow.ParentRow
Then we grabbed the ListObject for the row with the condition and used that to decide if we want to hide the column header or not.
Thanks!
Let me know how it goes. If this is no good, there are other things you could try.
Thanks, Mike! We'll give it a look and see if we can use the creation filter like you did in your code, and if we like how it looks.
Hi Seth,
If it's the last column (or two) then that will make things easier. I've given this some further thought, and I don't think you will be able to completely hide the column even with a CreationFilter, because the row borders will still extend to where the column would have been. But if you are not too picky about how it looks, I think you could achieve something acceptable.
I have attached a simple sample here that hides the cells by setting the Hidden property on the cell in the InitializeRow event and uses a CreationFilter to remove the header text.
Hello Mike,
I am working with Jeff on this issue.
There are two columns that we want to hide, but they are the two latest columns, so it seems like using the CreationFilter or DrawFilter would be the best option for this problem. Are there any existing posts in the forums that show how to set the specific subset of column headers that we're after to a specific value?
If not, how would we go about tackling this issue?
Thank you!
-Seth