Grid sorting not enabled

4 posts, 0 answers
  1. LJZIMMERMAN
    LJZIMMERMAN avatar
    5 posts
    Member since:
    Oct 2011

    Posted 12 Oct Link to this post

    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?

     

     

  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 17 Oct Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. LJZIMMERMAN
    LJZIMMERMAN avatar
    5 posts
    Member since:
    Oct 2011

    Posted 17 Oct in reply to Kostadin Link to this post

    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.

  5. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 20 Oct Link to this post

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