Sort Grid Bound column with grouping

2 posts, 0 answers
  1. Michael Nagy
    Michael Nagy avatar
    18 posts
    Member since:
    May 2008

    Posted 28 Jan 2009 Link to this post

    hello ,
    i have a rad grid with 3 column
      <telerik:GridBoundColumn HeaderText="Name" UniqueName="Name" DataField="Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Description" UniqueName="Description" DataField="Description">
                    </telerik:GridBoundColumn>
                    <telerik:GridDropDownColumn HeaderText="Building" UniqueName="Building" DropDownControlType="DropDownList"
                        DataField="Building" AllowSorting="true" SortExpression="OfficeName">
                    </telerik:GridDropDownColumn>

    and i am using group setting
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="BuildingName" FieldAlias="OfficeName" HeaderText="Office Name" />
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="BuildingName" SortOrder="Ascending"></telerik:GridGroupByField>
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>

    the problem when click on Building column to sort the grid by BuildingName nothing happened . when i removed the group of BuildingName sorting working well so think this is an issue when sort a column that has a group by field value at grip group setting so i think i need to change the sort order of the group field at sort command for this grid . please provide me a code that make change  sort order at sort command


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Jan 2009 Link to this post

    Hello Michael,

    Try setting the SortExpression for the GridDropDownColumn to "BuildingName". The SortExpression should match the DataField of a column in your database:
    aspx:
        <telerik:GridDropDownColumn HeaderText="Building" UniqueName="Building" DropDownControlType="DropDownList" DataField="Building" AllowSorting="true" SortExpression="BuildingName"
        </telerik:GridDropDownColumn> 

    Thanks
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top