Html.Grid(Model) Problem

Aug 7, 2013 at 7:47 PM
I am so new to MVC but I try to use Grid.Mvc. But I couldn't solve the these problem. Probably it so easy but I have no idea. If you help me, I will be appreciated.


'System.Web.Mvc.HtmlHelper<dynamic>' has no applicable method named 'Grid' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
Coordinator
Aug 8, 2013 at 4:13 AM
Hi, did you install the grid in your project? See https://gridmvc.codeplex.com/wikipage?title=Installation&referringTitle=Documentation

Also you need to pass IEnumerable collection or Grid object to the Grid method.
@model IEnumerable<Order>
....

@Html.Grid(Model).Columns( ... )
Please see: Quick start - https://gridmvc.codeplex.com/wikipage?title=Quick%20start&referringTitle=Documentation
Aug 8, 2013 at 2:39 PM
Thanks, @model IEnumerable<Order> really helped me a lot.
Oct 23, 2013 at 12:07 PM
Hi,

I'm having this problem. Do not understand the solution. @model IEnumerable<Order> Whats "Order" ?

@using GridMvc.Html
@using GridMvc.Html



@Html.Grid(Model).Columns(columns =>
{
    /* Adding not mapped column, that renders body, using inline Razor html helper */
    columns.Add()
            .Encoded(false)
            .Sanitized(false)
            .SetWidth(30)
            .RenderValueAs(d =>
                @<b>
                    @Html.ActionLink("Edit", "Index")
                </b>);
    columns.Add(model => model.ReleationName)
               .Titled("ReleationName")
               .SetWidth(100);
               
}).WithPaging(15).Sortable().Filterable().WithMultipleFilters()
and Controller
public ActionResult Index()
        {
            using (Entities context = new Entities())
            {
                IEnumerable<sp_List2_Result> ObjPDTable = context.sp_Procedure1().ToList();

                return View(ObjPDTable);
            }
        }
Coordinator
Oct 24, 2013 at 3:47 AM
Hi,

Order is your object in IEnumrable collection, which you need to render in the grid. In your case is sp_List2_Result
Oct 24, 2013 at 7:11 AM
Thanks for help, its great.