This is a migrated thread and some comments may be shown as answers.

sorting on grid load

1 Answer 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 09 Apr 2010, 12:32 PM
Hi,

    i need to apply descending sorting for one column while loading the grid for the first time itself. is there any column properties for this. or should be done from the code behind?
if so please provide the code snippet.

Thanks,
Saravanan K

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 09 Apr 2010, 01:11 PM
Hello Saravanan,

You can set default sort expression for the MasterTableView or a detail GridTableView directly in the ASPX declaration of the grid. When the grid is first loaded on the page, it is sorted based on the GridSortExpression objects in the SortExpressions collection.

aspx:
 
    <MasterTableView AutoGenerateColumns="False" EditMode="InPlace" PageSize="20" CommandItemDisplay="Top" 
        DataSourceID="SqlDataSource1" ClientDataKeyNames="CustomerID" DataKeyNames="CustomerID"
        <SortExpressions> 
            <telerik:GridSortExpression FieldName="CustomerID" SortOrder="Ascending"/> 
        </SortExpressions> 
        <Columns> 

Thanks,
Princy.
Tags
Grid
Asked by
saravanan k
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or