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

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

2 Answers 455 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Roger asked on 06 Jun 2019, 12:55 PM

     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 Answers, 1 is accepted

Sort by
0
Roger
Top achievements
Rank 2
Iron
Iron
Iron
answered on 06 Jun 2019, 01:48 PM

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.

 

0
Accepted
Vessy
Telerik team
answered on 07 Jun 2019, 08:25 AM
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.
Tags
Grid
Asked by
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Roger
Top achievements
Rank 2
Iron
Iron
Iron
Vessy
Telerik team
Share this question
or