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

3 posts, 1 answers
  1. Roger
    Roger avatar
    10 posts
    Member since:
    Apr 2019

    Posted 06 Jun Link to this post

         I have a user control with a RadGrid in my applicaiton.

     

    The RadGrid fills properly by binding a datatable to the grid.  It shows properly on the screen with data.

     

    Once I try to Sort or group, I am getting this error:

     

    Any suggestions would be appreciated.  I am on Version 2019.2.514.40 of Telerik asp.net controls.

     

    Unable to cast object of type 'ASP.masterpages_main_master' to type 'Telerik.Web.UI.GridTableView'.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.InvalidCastException: Unable to cast object of type 'ASP.masterpages_main_master' to type 'Telerik.Web.UI.GridTableView'.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace: 

    [InvalidCastException: Unable to cast object of type 'ASP.masterpages_main_master' to type 'Telerik.Web.UI.GridTableView'.] Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +3585 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9884270 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1639

     

    Thanks,

     

    Rog

  2. Roger
    Roger avatar
    10 posts
    Member since:
    Apr 2019

    Posted 06 Jun in reply to Roger Link to this post

    While doing more research I did find this article describing a very similar issue:

     

    https://www.telerik.com/forums/unable-to-cast-object-of-type-asp-masterpage-master-to-type-telerik-web-ui-gridtableview

     

     <!-- <xhtmlConformance mode="Legacy"/> -->
        <xhtmlConformance mode="Transitional"/>

     

    Changing  this item in my web.config did indeed fix the issue.  Now  I nee to do some testing to see if other places in the web app used the Legacy mode.

     

  3. Answer
    Vessy
    Admin
    Vessy avatar
    2068 posts

    Posted 07 Jun Link to this post

    Hi Roger,

    As per your finding,setting the <xhtmlConformance mode="Legacy"/> is incompatible with ASP.NET AJAX controls and it should be removed. This setting could be added when upgrading an old project with Visual Studio.

    You can find more information about the <xhtmlConformance mode="Legacy"/> setting in the following blog post: Don't use <xhtmlConformance mode="Legacy"/> with ASP.NET AJAX.

    Regards,
    Vessy
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top