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

Sorting

1 Answer 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darrell
Top achievements
Rank 1
Darrell asked on 20 Nov 2015, 03:29 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 23 Nov 2015, 02:15 PM
Hello,

In order to make the sorting default by "Name" you should make sure that field with this UniqueName exists in the database.

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
Darrell
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or