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

[Solved] System.MissingMethodException: Cannot create an instance of an interface

2 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thomas
Top achievements
Rank 1
Thomas asked on 24 Sep 2010, 05:47 PM
I get the error:
System.MissingMethodException: Cannot create an instance of an interface
at
Line 13:     <%= Html.Telerik().Grid(Model)

I have a view that is based on an interface, like so:

 

 

 

<%
   
@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ISomething>>" %>
Format Code Block (
<%= Html.Telerik().Grid(Model) 
 .Name("vSomething"
 .Sortable()
.DataKeys(dataKeys => dataKeys.Add(a => a.Id))
.ToolBar(commands => commands.Insert())
.DataBinding(dataBinding => dataBinding.Server()
  .Update("Update", "Admin"
  .Insert("Insert", "Admin"
)
.Columns(columns => {
  columns.Bound(a => a.Name);
  columns.Command(commands => commands.Edit());
})
%>

 

 

 

)

I really need the view to be based on an interface. What can I do to fix this?

 

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Sep 2010, 09:31 AM
Hi Thomas,

I created a sample application showing how to use interfaces during editing. Have in mind though that this only works for server side editing. For ajax editing the grid needs to render the editor templates before going in edit mode and thus tries to instantiate the model. If the model is interface this would fail.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Krishna
Top achievements
Rank 1
answered on 03 Aug 2011, 08:41 PM
I have this same problem. I am trying to edit values in a Grid. The View is based on an Interface. I have used Server binding but I still get this error. Please help. 
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Krishna
Top achievements
Rank 1
Share this question
or