Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
Default filtered combo in grid
posted

So I have a ultragrid with a list of custom objects as it's datasource. Two of the columns have ultracombos for drop down selection. The first column is for warehouse and is not filtered. The second column is bin and it is filtered based on the selection of the first combo. I have this working on the BeforeCellActivate event where I add a filter. However, I also need this to work when the data loads. So the process is below

Set Datasource to list of custom objects. The bin property (column) has values in it. 

Set combo to editor of column

Data appears but it shows the wrong Text value. It's wrong because it's actually the wrong item. 

So sample data in the bin Column - The values are duplicated when not filtered so it looks like below. The combo is filtered off another column that is not shown called Warehouse. So if the value in Bin column is 01, it gets the first item in the list but it is not filtered, so it gets 01 Bin. I need to get 01 Primary. I tried to set the filters when the data loads but that didn't work. I tried actually looping through the values and matching them against the combo value that it should get and tried changing to empty string then the correct value so the valuechanged event would fire, but that didn't work either. 

Is there anyway to have the correct item selected (i.e. the correct Text value displaying) when first loading the datasource for a grid? 

VM/DM

01  Bin

01  Primary

01  Seconday

02  Primary

Here is my code for the filter. 

UltraGridBand rootBand = cmbPriBin.DisplayLayout.Bands[0];
rootBand.ColumnFilters.ClearAllFilters();
rootBand.ColumnFilters["WarehouseCode"].FilterConditions.Add(FilterComparisionOperator.Equals, args.Cell.Row.Cells["PrimWhse"].Value);