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

[Solved] Help with Grid tutorial

3 Answers 206 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.
Elaine Sum
Top achievements
Rank 1
Elaine Sum asked on 26 Feb 2010, 03:35 PM
Hi there,

I am new to ASP.NET MVC and Telerik and just starting out with these technology. I am following the introduction documentation that came with the Telerik Extensions for ASP.NET MVC with trying to build a Grid in my application.

After creating the controller to reference my model, I am now stuck at binding the model to my view page.

This is the code from my index.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Telerik1.Models.Order>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<%= Html.Telerik().Grid(Model)
        .Name("OrdersGrid")
        .Columns(colums =>
        {
            colums.Bound(o => o.OrderID);
            colums.Bound(o => o.ShipAddress);
            colums.Bound(o => o.RequiredDate);
        })
        .Pageable()
        .Sortable()
%>
</asp:Content>

Somehow Visual Studio 2010 is telling me that <%= Html.Telerik().Grid(Model) is an error. 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.

Can someone please tell me where I am going wrong?



3 Answers, 1 is accepted

Sort by
0
Elaine Sum
Top achievements
Rank 1
answered on 01 Mar 2010, 07:09 AM
Just to bump this thread again. I tried running the Grid examples that came with Telerik MVC Extensions and they all reported the same error. The live demo from the Telerik website worked fine but not the examples that came with Telerik. Is this due to the MVC extensions not being supported on Visual Studio 2010? or .Net 4?
0
Atanas Korchev
Telerik team
answered on 01 Mar 2010, 08:18 AM
Hello Elaine Sum,

Telerik Extensions for ASP.NET MVC are supported on Visual Studio 2010. For you reference I am attaching the sample project converted to VS2010 format.

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
Elaine Sum
Top achievements
Rank 1
answered on 02 Mar 2010, 07:39 AM
I tried building and running the examples that you gave me but came up with this error: "No overload for method ToGridModel". The offending line is this:
                         return northwind.Orders.ToGridModel(page, size, orderBy, filter);

I found the answer to my problem on one of your developer's blog post. The problem was with the viewpage declaration on Telerik's documentation and I had to install ASP.NET MVC 2 RC as well.

I had to do use Inherits="System.Web.Mvc.ViewPage<IEnumerable<TelerikMVC2.Models.Order>>" instead of what was specified in the documentation.

Would there be an update to the documentation released in future?

Tags
Grid
Asked by
Elaine Sum
Top achievements
Rank 1
Answers by
Elaine Sum
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or