This question is locked. New answers and comments are not allowed.
Good morning everyone,
I am experiencing problem with binding the grid. I have to precise this is my first time using MVC framework and telerik MVC controls.
I try two different ways according to server binding instruction but still get some errors
Unless I am wrong my views are strongly typed according the inherits value of the page declaration.
here is my first way
controller:
view:
Doing this I get the followinf error:
So I modify my view specifying the model type into grid declaration:
and get the following error:
If someone can point me what I may doing wrong, would be great. Thank you!
I am experiencing problem with binding the grid. I have to precise this is my first time using MVC framework and telerik MVC controls.
I try two different ways according to server binding instruction but still get some errors
Unless I am wrong my views are strongly typed according the inherits value of the page declaration.
here is my first way
controller:
| public ActionResult Index() |
| { |
| CasEntities db = new CasEntities(); |
| return View(db.NUMBERSet.ToList()); |
| } |
view:
| <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AdminCAS.Models.NUMBER>" %> |
| <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> |
| Index |
| </asp:Content> |
| <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> |
| <h2>List of CAS Number</h2> |
| <%= Html.Telerik().Grid(Model) |
| .Name("NumberGrid") |
| .Pageable() |
| .Sortable()%> |
| </asp:Content> |
Doing this I get the followinf error:
| Server Error in '/' Application. |
| -------------------------------------------------------------------------------- |
| Compilation Error |
| Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. |
| Compiler Error Message: CS0411: The type arguments for method 'Telerik.Web.Mvc.UI.ViewComponentFactory.Grid<T>(System.Collections.Generic.IEnumerable<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. |
| Source Error: |
| Line 9: <h2>List of CAS Number</h2> |
| Line 10: |
| Line 11: <%= Html.Telerik().Grid(Model) |
| Line 12: .Name("NumberGrid") |
| Line 13: .Pageable() |
So I modify my view specifying the model type into grid declaration:
| <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<AdminCAS.Models.NUMBER>" %> |
| <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> |
| Index |
| </asp:Content> |
| <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> |
| <h2>List of CAS Number</h2> |
| <%= Html.Telerik().Grid<AdminCAS.Models.NUMBER>(Model) |
| .Name("NumberGrid") |
| .Pageable() |
| .Sortable()%> |
| </asp:Content> |
and get the following error:
| Server Error in '/' Application. |
| -------------------------------------------------------------------------------- |
| Compilation Error |
| Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. |
| Compiler Error Message: CS1502: The best overloaded method match for 'Telerik.Web.Mvc.UI.ViewComponentFactory.Grid<AdminCAS.Models.NUMBER>(System.Collections.Generic.IEnumerable<AdminCAS.Models.NUMBER>)' has some invalid arguments |
| Source Error: |
| Line 9: <h2>List of CAS Number</h2> |
| Line 10: |
| Line 11: <%= Html.Telerik().Grid<AdminCAS.Models.NUMBER>(Model) |
| Line 12: .Name("NumberGrid") |
| Line 13: .Pageable() |
If someone can point me what I may doing wrong, would be great. Thank you!