1. Darrell
    Darrell avatar
    1 posts
    Member since:
    Nov 2015

    Posted 20 Nov 2015 Link to this post

    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
  2. Pavlina
    Admin
    Pavlina avatar
    6187 posts

    Posted 23 Nov 2015 Link to this post

    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
Back to Top