We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Why does ModelType parameter require an Object and not a Type? Or can ModelType use an object that defined as an Interface?

Thread ID:





147039 Aug 29,2019 03:56 PM UTC Aug 29,2019 04:59 PM UTC Blazor 1
Tags: Grid
Jeffrey West
Asked On August 29, 2019 03:56 PM UTC

I am displaying a grid using a collection of objects whose Type was generated at runtime. The grid has some Templated columns so I need to supply a ModelType attribute for the grid. The objects implement a statically defined interface. I have tried using an object that is typed as the Interface and an Object but I get a "System.InvalidCastException: Object must implement IConvertible." error. 

Is there a workaround for this issue? Would it be possible for ModelType to accept an actual Type instead of an object? Or perhaps the Template context can be derived from the TValue property. It seems that ModelType and TValue are somewhat redundant.

Any help would be greatly appreciated.



Jeffrey West
Replied On August 29, 2019 04:59 PM UTC

Never mind. I found a workaround by using a different Type that had properties with the same names.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon