Hi rohit..
hope this piece of code helps you out .
''to reset the default comparison operator
UltraGrid1.DisplayLayout.Bands(0).Columns("Your Column").FilterOperatorDefaultValue = FilterOperatorDefaultValue.Default
''to reset the default comparison type
''this is for reseting logical operator.
UltraGrid1.DisplayLayout.Rows.ColumnFilters.ResetLogicalOperator()
foreach (UltraGridFilterCell filterCell in this.ultraGrid1.Rows.FilterRow.Cells) { filterCell.FilterOperator = FilterComparisionOperator.Equals; }
I have recently had a request to have the Filter Operator values reset to the default values once all the filters have been cleared (this is done by selecting a menu choice and programmically all the filters are cleared out).
I found the code here, and it looks like it should work.
In the Initialize Layout, I placed the code to set the Filter Operator to the default value I want:
e.Layout.Bands(0).Columns(
"StartDate").FilterOperatorDefaultValue = FilterOperatorDefaultValue.StartsWith
And then in the Clear Filter code section, I added the code to reset the Filter Operator to the default values:
grdEmployeeInfo.DisplayLayout.Bands(0).Columns("StartDate").FilterOperatorDefaultValue = FilterOperatorDefaultValue.Default
The code seems to be ignored. I don't get an error, the Filter just does not reset to the default value.
I the 2nd line of code I shared here, so that instead of "FilterOperatorDefaultValue.Default" I put in "FilterOperatorDefaultValue.StartsWith".
The code was still ignored.
I tried Mike's code, but I do not have an option for "FilterCell.FilterOperator" any place I can see in my VB code window.
Any help would be appreciated.
Thank you,
T.J.
Dim J as Integer
For J = 0 To (grdEmployeeInfo.Rows.FilterRow.Cells.Count - 1)
grdEmployeeInfo.Rows.FilterRow.Cells(J)..FilterOperator = FilterComparisionOperator.Equals
Next
Mike,
Thank you for your help. I am looking into this. I am not a good developer, so I am sure I am missing something.
On the button I am coding to reset the Filters back to the default setting, I have added this code (VB, Infragistics 8.1)
In this loop, I will need to add the code to reset the Filters back to the default. I have tried various different options, but I cannot get FilterCell, FilterOperation, or anything close to these to show up in my intellisense).
I have tried all sorts of options under the grdEmployeeInfo reference, and I do not see anything close to these.
Sorry to be a bother, if it looks like I am on the wrong track, let me know. If it is just my VS, I will look to re-install it.
FilterOperatorDefaultValue only affect the default, so setting this property once the filter cell has already been displayed will do nothing. This property is only useful wihle initializing the filter row.
Why can't you use the FilterOperation property of the FilterCell as I do in my code above? I assure you that this property does exist and always has existing on the filter cell.If you are unable to find it, then something is wrong with your Visual Studio Intellisense - but that seems very unlikely.