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

Problems with sorting

2 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 06 Jan 2012, 06:00 PM
I have a form with a RadGrid which is data bound to a DataTable as  the page is loaded server side.  I have defined my grid as :-

<telerik:RadGrid ID="gridParts" runat="server" AllowSorting="True" CellSpacing="0" Height="690px" OnSelectedIndexChanged="gridParts_SelectedIndexChanged" AllowMultiRowSelection="False">
<ClientSettings>
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView AutoGenerateColumns="true" TableLayout="Fixed" DataKeyNames="PartNumber" AllowCustomSorting="false" AllowMultiColumnSorting="false" AllowNaturalSort="false" Alloo>
</MasterTableView>
<ClientSettings Selecting-AllowRowSelect="true" EnablePostBackOnRowClick="true">
<Resizing AllowColumnResize="true" ResizeGridOnColumnResize="false" AllowResizeToFit="true" ClipCellContentOnResize="true" EnableRealTimeResize="true" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" />
</ClientSettings>
</telerik:RadGrid>

From the documentation this should allow simple sorting to work.  I only have 2 columns in the grid which are auto-generated.  My problem is that nothing appears to happen when I click the column header to sort the items.  To I need to add anything else just to implement simple ascending/descending sorting?

2 Answers, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 06 Jan 2012, 07:58 PM
Chris:

I created a basic project using your client side markup for the RadGrid and simply modified the datasource to use the SQL Northwind database. On load, there is no column selected and no sort arrows visible. But, when I click directly on the column's name the sort asc/desc arrow appears and I am able to sort as expected.

If I click anywhere outside of the name, nothing happens, no sort arrows.

See the attached screenshot ("radgrid_with_sorting.png") for my application.

Also, try running the Grid/Basic Sorting demo at http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/sorting/defaultcs.aspx to be sure that the sorting works as expected in your browser. Compare your code against this sample.

Hope this helps.
0
Shinu
Top achievements
Rank 2
answered on 09 Jan 2012, 01:41 PM
Hello Chris,

In order to implement advanced features in RadGrid like paging, sorting etc, make sure that you are using Advanced data binding using NeedDataSource event. Check the following help documentation which explains more about this.
Advanced Data-binding (using NeedDataSource event).

-Shinu.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or