Chili.Opf3 Send comments on this topic.
Sort Property
See Also  Example
Chili.Opf3 Namespace > Generic ObjectView Class : Sort Property




Specifies the string to sort the ObjectView.

Syntax

Visual Basic (Declaration) 
Public Property Sort As String
Visual Basic (Usage)Copy Code
Dim instance As ObjectView(Of T)
Dim value As String
 
instance.Sort = value
 
value = instance.Sort
C# 
public string Sort {get; set;}
Managed Extensions for C++ 
public: __property string* get_Sort();
public: __property void set_Sort( 
   string* value
);
C++/CLI 
public:
property String^ Sort {
   String^ get();
   void set (String^ value);
}

Example

The following examples show how to sort a ObjectView by different properties in different directions.
C#Copy Code
// Load an ObjectSet with data. 
ObjectSet<User> objectSet = context.GetObjectSet<User>(); 
// Get the default view of the ObjectSet. 
ObjectView<User> objectView = objectSet.DefaultView; 
// Sorts the ObjectView by the ID property (in ascending order) and by the NAME 
// property (in the descending order). 
objectView.Sort = "[ID] ASC, [NAME] DESC";
C#Copy Code
// Load an ObjectSet with data. 
ObjectSet<User> objectSet = context.GetObjectSet<User>(); 
// Create a new ObjectView. 
ObjectView<User> objectView = new ObjectView<User>(); 
// Set the current ObjectSet as source of the view. 
objectView.ObjectSet = objectSet; 
// Sorts the ObjectView by the ID property (in ascending order). 
objectView.Sort = "[ID] ASC";

Remarks

This method allows to specify a string that sorts the ObjectView. The string contains the property and the direction of the sort. You may also specify more the one property and direction.

Requirements

Platforms: Windows 2000, Windows XP family, Windows Server 2003 family, Windows Vista family

See Also