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

Sorting

1 Answer 16 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 24 Aug 2015, 04:04 PM

Hi,

 

In the following code, the default sorting is by "clientId". How do I make the  sorting default by "Name"?

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="true" CssClass="RadGrid RadGrid_Silk" OnItemCommand="itemClickRadGrid" Visible="true" OnItemDataBound="RadGrid1_ItemDataBound"                 AllowSorting="True" AllowPaging="True" PageSize="100" AutoGenerateColumns="false" AllowFilteringByColumn="false" OnNeedDataSource="RadGrid1_NeedDataSource1">                 <MasterTableView GroupLoadMode="Client" TableLayout="Fixed" EnableGroupsExpandAll="false" DataKeyNames="FilingIdentifier" ShowHeader="false">                     <GroupByExpressions>                         <telerik:GridGroupByExpression>                             <SelectFields>                                 <telerik:GridGroupByField HeaderValueSeparator=" " HeaderText=" " FieldName="Name" SortOrder="Ascending"></telerik:GridGroupByField>                             </SelectFields>                             <GroupByFields>                                 <telerik:GridGroupByField FieldName="clientId"></telerik:GridGroupByField>                             </GroupByFields>                         </telerik:GridGroupByExpression>                     </GroupByExpressions>                     <Columns>                                                 <telerik:GridBoundColumn DataField="TaxYear" HeaderText="Year" UniqueName="TaxYear"></telerik:GridBoundColumn>                         <telerik:GridBoundColumn DataField="PreviousFiling" Visible="false" UniqueName="PreviousFiling"></telerik:GridBoundColumn>                         <telerik:GridBoundColumn DataField="ForwardFiling" Visible="false" UniqueName="ForwardFiling"></telerik:GridBoundColumn>                         <telerik:GridButtonColumn Text="Launch" UniqueName="lauchrow" CommandName="launchRow" ButtonType="PushButton" HeaderStyle-Width="70px"></telerik:GridButtonColumn>                         <telerik:GridButtonColumn Text="Add tax year" UniqueName="addTaxYear" CommandName="cf" ButtonType="PushButton" HeaderStyle-Width="110px"></telerik:GridButtonColumn>                     </Columns>                 </MasterTableView>                 <GroupingSettings />                 <ClientSettings AllowDragToGroup="false">                     <Selecting AllowRowSelect="true" />                 </ClientSettings>             </telerik:RadGrid>

 

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Aug 2015, 03:26 PM
Hello,

In order to make default sorting by Name you should have such field in the grid datasource. In the code you provided there is no column with DataField="Name".

Regards,
Pavlina
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Charles
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or