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

Grid sorting not enabled

3 Answers 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LJZIMMERMAN
Top achievements
Rank 1
LJZIMMERMAN asked on 12 Oct 2016, 03:02 PM

I had a grid which I would like to sort. However, it appears (and acts like) sorting is not enabled.

1st Quarter 2016

Here is my grid definition. There is quite a bit going on in the code behind, as this grid is datasource driven. I have code in prerender, itemcreated, columncreated and needdatasource, but nothing I can determine would affect the sort capabilities.

 

<telerik:RadGrid
ID="grdReportRecords"
runat="server"
RenderMode="Lightweight"
width="99%"
AllowSorting="True"
AllowMultiRowSelection="True"
AllowFilteringByColumn="true"
OnNeedDataSource="grdReportRecords_NeedDataSource"
ActiveItemStyle-BackColor="Yellow"
GroupPanelPosition="Top"
Skin="Silk">
<GroupingSettings
CollapseAllTooltip="Collapse all groups"
CaseSensitive="false">
</GroupingSettings>
<ClientSettings>
<Selecting
AllowRowSelect="true" />
<%--<Resizing AllowResizeToFit="true"
AllowColumnResize="true"
ResizeGridOnColumnResize="true"/>--%>
<ClientEvents
OnColumnCreated="ColumnCreated">
</ClientEvents>
</ClientSettings>
<ExportSettings
ExportOnlyData="True"
HideStructureColumns="True">
<Excel Format="Xlsx" />
</ExportSettings>
<MasterTableView
AllowMultiColumnSorting="true"
DataKeyNames="ReqID"
AllowSorting="true"
AllowFilteringByColumn="true"
CommandItemDisplay="top">
<CommandItemSettings
ShowAddNewRecordButton="false"
ShowExportToExcelButton="true"
ShowRefreshButton="False" />
<Columns>
<telerik:GridHyperLinkColumn
DataNavigateUrlFields="ReqID, RequestTypeAbbrev"
DataNavigateUrlFormatString="javascript:ShowEditForm({0}, '{1}')"
ImageUrl="images/view.gif"
UniqueName="GridLink_Edit"
HeaderText="View"
AllowFiltering="False">
<HeaderStyle HorizontalAlign="Center" width="40"/>
<ItemStyle HorizontalAlign="Center" width="40"/>
</telerik:GridHyperLinkColumn>
<telerik:GridClientSelectColumn
UniqueName="ClientSelectColumn">
<HeaderStyle HorizontalAlign="Center" width="40"/>
<ItemStyle HorizontalAlign="Center" width="40"/>
</telerik:GridClientSelectColumn>
<%--<telerik:GridTemplateColumn UniqueName="Select">
<HeaderTemplate>
<asp:CheckBox ID="chkView1" runat="server" onclick="selectall_clicked(this)" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkView" runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>--%>
<%--<telerik:GridTemplateColumn
UniqueName="View"
AllowFiltering="false">
<HeaderTemplate>
<asp:CheckBox
ID="chkView1"
runat="server"
onclick="return selectall_clicked(this);" />
<telerik:RadCheckBox ID="chkView1" runat="server" />
</HeaderTemplate>
<FilterTemplate>

</FilterTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkView" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</telerik:GridTemplateColumn>--%>
</Columns>
</MasterTableView>
<ClientSettings>
<ClientEvents OnColumnCreated="ColumnCreated" />
</ClientSettings>
<ActiveItemStyle BackColor="Yellow">
</ActiveItemStyle>
</telerik:RadGrid>

 

Could you please help?

 

 

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 17 Oct 2016, 08:32 AM
Hello,

Note that the sort is automatically enabled when you set AllosSorting property to true. I noticed that you already have enabled this property. Could you please verify that you are not receiving any client or server exception which might prevent sorting the grid? Additionally if you are using an ajax I would recommend you to temporary disable it and check if any exception is thrown.

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
LJZIMMERMAN
Top achievements
Rank 1
answered on 17 Oct 2016, 03:52 PM

I am not receiving any client or server errors when attempting to sort.  There is no ajax manager on the page as I removed it.

 

The grid still will not sort.

0
Kostadin
Telerik team
answered on 20 Oct 2016, 08:22 AM
Hello,

I prepared a small sample based on the provided code and on my side the sorting seems to work correctly. Could you please check out the attached sample and let me know how it differs from your real setup? In case you need to enable the sorting of the HyperLinkColumn you need to set appropriate SortExpression values for those columns. For additional details I would recommend you to examine the following help article.

I hope this information helps.

Regards,
Kostadin
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
LJZIMMERMAN
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
LJZIMMERMAN
Top achievements
Rank 1
Share this question
or