API
Version 7.x > API > Document sort with property View modes: 
User avatar
Member
Member
beau.cowan-rrpartners - 4/29/2013 11:50:04 AM
   
Document sort with property
I'm attempting to sort through a set of tree nodes that contains 3 different page types. One of the page types I need to sort by a property that I created.

How can sort through either the DataView or SQL to where I can have this property for the 1 document type come up first?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 4/30/2013 8:31:35 AM
   
RE:Document sort with property
Are you placing all your results in a dataset/datatable? If so, you try this simple function:
public static DataTable getSortedTable(DataTable dt, string columnName, string direction)
{
DataView dv = dt.DefaultView;
dv.Sort = columnName + " " + direction;
return dv.ToTable();
}