Grid - Clicking on the Header Line to Sort

2 posts, 0 answers
  1. Ben
    Ben avatar
    13 posts
    Member since:
    Aug 2015

    Posted 26 Jul 2016 Link to this post

    Hi All,

    I've a very simple page with a RadGrid, on clicking the header to sort, I get the error :-

    Unable to cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.GridTableView'.

    This only happened after upgrading the DLLs to 2016.2.607.40 from 2014.1.403.40
    Going back to the old DLL fixes the issue.

    Serverside I populate a DataTable and then use Datasource/Databind.

     

    <telerik:RadGrid ID="dtgParameter" runat="server" CssClass="dataGridStyle" Width="99%" GridLines="Both" Height="100px" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="False" AutoGenerateColumns="False" ShowFooter="false" ShowHeader="true">
                    <HeaderStyle CssClass="dataGridHeader" />
                    <ItemStyle CssClass="dataGridItemStyleNormal" />
                    <AlternatingItemStyle CssClass="dataGridItemStyleAlt" />
                    <SortingSettings EnableSkinSortStyles="false" />
                    <ClientSettings EnablePostBackOnRowClick="false">
                        <Selecting AllowRowSelect="true" UseClientSelectColumnOnly="true" />
                        <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" />
                    </ClientSettings>
                    <MasterTableView Name="Parameter" DataKeyNames="ParameterId" ShowHeader="true" AutoGenerateColumns="False" HierarchyLoadMode="ServerOnDemand" width="99%">
                        <Columns>
                            <telerik:GridBoundColumn HeaderStyle-ForeColor="White" DataField="ParameterId"  HeaderStyle-Font-Bold="True" SortExpression="ParameterId"  HeaderStyle-Width="0%"  HeaderText="" visible="false"/>
                            <telerik:GridBoundColumn HeaderStyle-ForeColor="White" DataField="Name"                             HeaderStyle-Font-Bold="True" SortExpression="Name"                  HeaderStyle-Width="20%" HeaderText="Name" />
                            <telerik:GridBoundColumn HeaderStyle-ForeColor="White" DataField="Comments"                         HeaderStyle-Font-Bold="True" SortExpression="Comments"              HeaderStyle-Width="80%" HeaderText="Comments" />
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
  2. Ben
    Ben avatar
    13 posts
    Member since:
    Aug 2015

    Posted 27 Jul 2016 in reply to Ben Link to this post

    Think I founf the issue (searching on here, not Google) Few links ..

    http://www.telerik.com/forums/unable-to-cast-object-of-type-telerik-web-ui-radgrid-to-type-telerik-web-ui-gridtableview

    leads to

    http://www.telerik.com/forums/255649-unable-to-cast-object-of-type-telerik-web-ui-radgrid-to-type-telerik-web-ui-gridtableview

    and then

    http://weblogs.asp.net/scottgu/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax

    Which we have, need to remove this in the Web.Config :-

        <xhtmlConformance mode="Legacy"/>
Back to Top