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

Problem with sorting

2 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pams
Top achievements
Rank 1
Pams asked on 28 Oct 2010, 03:03 PM
hello,
I am using a radgrid.
In that I have some columns. I am also using sorting functionality of radgrid.
<telerik:RadGrid ID="EmployeeRadGrid" runat="server" AllowPaging="True" DataSourceID="EmployeeDataSource"
                AllowFilteringByColumn="True" AutoGenerateColumns="false" OnItemDataBound="EmployeeRadGrid_ItemDataBound"
                GridLines="None" AllowCustomPaging="true" AllowSorting="true" PageSize="10" >
<MasterTableView AllowMultiColumnSorting="true" ClientDataKeyNames="Id" DataKeyNames="All the column names present in the data"
                    CommandItemDisplay="None" DataSourceID="EmployeeDataSource">
         <Columns>
            <telerik:GridBoundColumn DataField="EmployeeId" UniqueName="EmployeeId" HeaderText="employeeid"
                            SortExpression="EmployeeId" AllowSorting="true" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                            AutoPostBackOnFilter="true">
              </telerik:GridBoundColumn>
          </Columns>
</MasterTableView>

<asp:ObjectDataSource ID="EmployeeDataSource" runat="server" EnablePaging="True"
                TypeName="Layer where my method is present" SelectCountMethod="getEmployeeCount"
                SelectMethod="getAllEmployee" StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maximumRows"
                SortParameterName="sortBy" ></asp:ObjectDataSource>



Now when I click on the employeeid column, evrytime the call is going to the method "getAllEmployee" to retrieve the data. That method has "startRowIndex", "maximumRows" and "sortBy parameters.
Everytime the startRowIndex and maximumRows parameter values are received correctly according to page size. But the sortBy value is "" always.

So, when i click on the column employeeid, only that page data is getting sorted. The whole data which is bound to radgrid is not getting sorted.

Any help pls.
Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Pams
Top achievements
Rank 1
answered on 28 Oct 2010, 09:36 PM
Hello,
In the previous problem. I found one thing. I had one more column which is gridcalculated column.
<telerik:GridCalculatedColumn  UniqueName="EmployeeName" SortExpression="LastName" HeaderText="Employee Name"
     DataFields="LastName, FirstName, MiddleName" CurrentFilterFunction="Contains" ShowFilterIcon="false"
                          Expression='{0} + "&nbsp;" + {1} + "&nbsp;" +{2}'  AutoPostBackOnFilter="true">
</telerik:GridCalculatedColumn>

When I removed this column the grid is passing sortBy parameter value.
Else, for all the other columns the sortBy parameter value is null while sorting is done.

I don't know the reason while sorting is not behaving properly if I keep GridCalculatedCOlumn
Any urgent help pls.

Thank you
0
Iana Tsolova
Telerik team
answered on 02 Nov 2010, 03:25 PM
Hello Pams,

Does it makes any difference if you set the AllowCustomSorting property of the grid MasterTableView to true?

Greetings,
Iana
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Pams
Top achievements
Rank 1
Answers by
Pams
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or