Gets or sets the sort column or columns, and sort order for the DataView.
[Visual Basic] Public Property Sort As String [C#] public string Sort {get; set;} [C++] public: __property String* get_Sort(); public: __property void set_Sort(String*); [JScript] public function get Sort() : String; public function set Sort(String);
A string containing the column name followed by "ASC" (ascending) or "DESC" (descending). Columns are sorted ascending by default. Multiple columns can be separated by commas.
For more information, see
[Visual Basic, C#] The following example instructs the DataView to sort the table by two columns.
[Visual Basic] Private Sub SortByTwoColumns() ' Get the DefaultViewManager of a DataTable. Dim myDataView As DataView myDataView = DataTable1.DefaultView ' By default, the first column sorted ascending. myDataView.Sort = "State, ZipCode DESC" End Sub [C#] private void SortByTwoColumns() { // Get the DefaultViewManager of a DataTable. DataView myDataView = DataTable1.DefaultView; // By default, the first column sorted ascending. myDataView.Sort = "State, ZipCode DESC"; }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework - Windows CE .NET
DataView Class | DataView Members | System.Data Namespace | RowFilter | Expression