You can create your own filtering method using the FilterDefinition property to save/load custom filters in code.
You can apply one of a few pre-defined filters by reading the FilterDefinition property from a xml file like the following:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub ReadFilter(name As String) c1TrueDBGrid1.Splits(0).FilterDefinition = System.IO.File.ReadAllText(name & ".xml") End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
void ReadFilter(string name) { c1TrueDBGrid1.Splits[0].FilterDefinition = System.IO.File.ReadAllText(name + ".xml"); } |
The custom filter can then be applied to the grid and saved as custom like the following:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub SaveCustomFilter() System.IO.File.WriteAllText("custom.xml", Me.c1TrueDBGrid1.Splits(0).FilterDefinition) End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
void SaveCustomFilter() { System.IO.File.WriteAllText("custom.xml", this.c1TrueDBGrid1.Splits[0].FilterDefinition); } |